Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
40387290
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
40387290
编写于
4月 14, 2023
作者:
P
plum-lihui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: modify test case
上级
eef0c845
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
103 addition
and
14 deletion
+103
-14
tests/system-test/7-tmq/tmqConsumerGroup.py
tests/system-test/7-tmq/tmqConsumerGroup.py
+103
-14
未找到文件。
tests/system-test/7-tmq/tmqConsumerGroup.py
浏览文件 @
40387290
...
...
@@ -42,7 +42,7 @@ class TDTestCase:
'showRow'
:
1
}
topicNameList
=
[
'topic1'
,
'topic2'
]
expect
RowsList
=
[]
query
RowsList
=
[]
tmqCom
.
initConsumerTable
()
tdCom
.
create_database
(
tdSql
,
paraDict
[
"dbName"
],
paraDict
[
"dropFlag"
],
vgroups
=
4
,
replica
=
1
)
tdSql
.
execute
(
"alter database %s wal_retention_period 3600"
%
(
paraDict
[
'dbName'
]))
...
...
@@ -60,7 +60,7 @@ class TDTestCase:
tdLog
.
info
(
"create topic sql: %s"
%
sqlString
)
tdSql
.
execute
(
sqlString
)
tdSql
.
query
(
queryString
)
expect
RowsList
.
append
(
tdSql
.
getRows
())
query
RowsList
.
append
(
tdSql
.
getRows
())
# create one stb2
paraDict
[
"stbName"
]
=
'stb2'
...
...
@@ -77,7 +77,7 @@ class TDTestCase:
tdLog
.
info
(
"create topic sql: %s"
%
sqlString
)
tdSql
.
execute
(
sqlString
)
# tdSql.query(queryString)
#
expect
RowsList.append(tdSql.getRows())
#
query
RowsList.append(tdSql.getRows())
# init consume info, and start tmq_sim, then check consume result
tdLog
.
info
(
"insert consume info to consume processor"
)
...
...
@@ -99,7 +99,8 @@ class TDTestCase:
pThread
=
tmqCom
.
asyncInsertData
(
paraDict
)
tdLog
.
info
(
"wait consumer commit notify"
)
tmqCom
.
getStartCommitNotifyFromTmqsim
(
rows
=
4
)
# tmqCom.getStartCommitNotifyFromTmqsim(rows=4)
tmqCom
.
getStartConsumeNotifyFromTmqsim
(
rows
=
2
)
tdLog
.
info
(
"pkill one consume processor"
)
tmqCom
.
stopTmqSimProcess
(
'tmq_sim_new'
)
...
...
@@ -109,19 +110,21 @@ class TDTestCase:
tdLog
.
info
(
"wait the consume result"
)
expectRows
=
2
resultList
=
tmqCom
.
selectConsumeResult
(
expectRows
)
actTotalRows
=
0
act
Consum
TotalRows
=
0
for
i
in
range
(
len
(
resultList
)):
actTotalRows
+=
resultList
[
i
]
actConsumTotalRows
+=
resultList
[
i
]
tdLog
.
info
(
"act consumer1 rows: %d, consumer2 rows: %d"
%
(
resultList
[
0
],
resultList
[
1
]))
tdSql
.
query
(
queryString
)
expect
RowsList
.
append
(
tdSql
.
getRows
())
expect
TotalRows
=
0
for
i
in
range
(
len
(
expect
RowsList
)):
expectTotalRows
+=
expect
RowsList
[
i
]
tdLog
.
info
(
"act consume rows: %d,
expect consume rows: %d"
%
(
actTotalRows
,
expect
TotalRows
))
if
expectTotalRows
<=
resultList
[
0
]
:
tdLog
.
info
(
"act consume rows: %d should >=
expect consume rows: %d"
%
(
actTotalRows
,
expect
TotalRows
))
query
RowsList
.
append
(
tdSql
.
getRows
())
query
TotalRows
=
0
for
i
in
range
(
len
(
query
RowsList
)):
queryTotalRows
+=
query
RowsList
[
i
]
tdLog
.
info
(
"act consume rows: %d,
query consume rows: %d"
%
(
actConsumTotalRows
,
query
TotalRows
))
if
actConsumTotalRows
<
queryTotalRows
:
tdLog
.
info
(
"act consume rows: %d should >=
query consume rows: %d"
%
(
actConsumTotalRows
,
query
TotalRows
))
tdLog
.
exit
(
"0 tmq consume rows error!"
)
# time.sleep(10)
...
...
@@ -130,9 +133,95 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"======== test case 1 end ...... "
)
def
tmqCase2
(
self
):
tdLog
.
printNoPrefix
(
"======== test case 2: "
)
paraDict
=
{
'dbName'
:
'db1'
,
'dropFlag'
:
1
,
'event'
:
''
,
'vgroups'
:
4
,
'stbName'
:
'stb'
,
'colPrefix'
:
'c'
,
'tagPrefix'
:
't'
,
'colSchema'
:
[{
'type'
:
'INT'
,
'count'
:
2
},
{
'type'
:
'binary'
,
'len'
:
20
,
'count'
:
1
},{
'type'
:
'TIMESTAMP'
,
'count'
:
1
}],
'tagSchema'
:
[{
'type'
:
'INT'
,
'count'
:
1
},
{
'type'
:
'binary'
,
'len'
:
20
,
'count'
:
1
}],
'ctbPrefix'
:
'ctb'
,
'ctbNum'
:
10
,
'rowsPerTbl'
:
1000
,
'batchNum'
:
10
,
'startTs'
:
1640966400000
,
# 2022-01-01 00:00:00.000
'pollDelay'
:
20
,
'showMsg'
:
1
,
'showRow'
:
1
}
topicNameList
=
[
'topic3'
,
'topic4'
]
queryRowsList
=
[]
tmqCom
.
initConsumerTable
()
tdLog
.
info
(
"create topics from stb with filter"
)
# queryString = "select ts, log(c1), ceil(pow(c1,3)) from %s.%s where c1 %% 7 == 0" %(paraDict['dbName'], paraDict['stbName'])
queryString
=
"select ts, log(c1), ceil(pow(c1,3)) from %s.%s"
%
(
paraDict
[
'dbName'
],
paraDict
[
'stbName'
])
sqlString
=
"create topic %s as %s"
%
(
topicNameList
[
0
],
queryString
)
tdLog
.
info
(
"create topic sql: %s"
%
sqlString
)
tdSql
.
execute
(
sqlString
)
tdSql
.
query
(
queryString
)
queryRowsList
.
append
(
tdSql
.
getRows
())
# create one stb2
paraDict
[
"stbName"
]
=
'stb2'
# queryString = "select ts, sin(c1), abs(pow(c1,3)) from %s.%s where c1 %% 7 == 0" %(paraDict['dbName'], paraDict['stbName'])
queryString
=
"select ts, sin(c1), abs(pow(c1,3)) from %s.%s"
%
(
paraDict
[
'dbName'
],
paraDict
[
'stbName'
])
sqlString
=
"create topic %s as %s"
%
(
topicNameList
[
1
],
queryString
)
tdLog
.
info
(
"create topic sql: %s"
%
sqlString
)
tdSql
.
execute
(
sqlString
)
tdSql
.
query
(
queryString
)
queryRowsList
.
append
(
tdSql
.
getRows
())
# init consume info, and start tmq_sim, then check consume result
tdLog
.
info
(
"insert consume info to consume processor"
)
consumerId
=
0
paraDict
[
"rowsPerTbl"
]
=
5000
expectrowcnt
=
paraDict
[
"rowsPerTbl"
]
*
paraDict
[
"ctbNum"
]
*
2
topicList
=
"%s,%s"
%
(
topicNameList
[
0
],
topicNameList
[
1
])
ifcheckdata
=
1
ifManualCommit
=
1
keyList
=
'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:3000, auto.offset.reset:earliest'
tmqCom
.
insertConsumerInfo
(
consumerId
,
expectrowcnt
,
topicList
,
keyList
,
ifcheckdata
,
ifManualCommit
)
tdLog
.
info
(
"start consume processor 1"
)
tmqCom
.
startTmqSimProcess
(
paraDict
[
'pollDelay'
],
paraDict
[
"dbName"
],
paraDict
[
'showMsg'
],
paraDict
[
'showRow'
])
tdLog
.
info
(
"start consume processor 2"
)
tmqCom
.
startTmqSimProcess
(
paraDict
[
'pollDelay'
],
paraDict
[
"dbName"
],
paraDict
[
'showMsg'
],
paraDict
[
'showRow'
],
'cdb'
,
0
,
1
)
tdLog
.
info
(
"wait the consume result"
)
expectRows
=
2
resultList
=
tmqCom
.
selectConsumeResult
(
expectRows
)
actConsumTotalRows
=
0
for
i
in
range
(
len
(
resultList
)):
actConsumTotalRows
+=
resultList
[
i
]
tdLog
.
info
(
"act consumer1 rows: %d, consumer2 rows: %d"
%
(
resultList
[
0
],
resultList
[
1
]))
queryTotalRows
=
0
for
i
in
range
(
len
(
queryRowsList
)):
queryTotalRows
+=
queryRowsList
[
i
]
tdLog
.
info
(
"act consume rows: %d, query consume rows: %d"
%
(
actConsumTotalRows
,
queryTotalRows
))
if
actConsumTotalRows
<
queryTotalRows
:
tdLog
.
info
(
"act consume rows: %d should >= query consume rows: %d"
%
(
actConsumTotalRows
,
queryTotalRows
))
tdLog
.
exit
(
"0 tmq consume rows error!"
)
# time.sleep(10)
# for i in range(len(topicNameList)):
# tdSql.query("drop topic %s"%topicNameList[i])
tdLog
.
printNoPrefix
(
"======== test case 2 end ...... "
)
def
run
(
self
):
tdSql
.
prepare
()
self
.
tmqCase1
()
self
.
tmqCase2
()
def
stop
(
self
):
tdSql
.
close
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录