Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7bc5bb08
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看板
提交
7bc5bb08
编写于
5月 12, 2022
作者:
P
plum-lihui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[test: modify test process for tmq]
上级
3967f79b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
21 deletion
+20
-21
tests/system-test/7-tmq/basic5.py
tests/system-test/7-tmq/basic5.py
+18
-19
tests/test/c/tmqSim.c
tests/test/c/tmqSim.c
+2
-2
未找到文件。
tests/system-test/7-tmq/basic5.py
浏览文件 @
7bc5bb08
...
...
@@ -114,7 +114,7 @@ class TDTestCase:
def
tmqCase1
(
self
,
cfgPath
,
buildPath
):
tdLog
.
printNoPrefix
(
"======== test
scenario
1: "
)
tdLog
.
printNoPrefix
(
"======== test
case
1: "
)
tdLog
.
info
(
"step 1: create database, stb, ctb and insert data"
)
# create and start thread
parameterDict
=
{
'cfg'
:
''
,
\
...
...
@@ -122,8 +122,8 @@ class TDTestCase:
'vgroups'
:
1
,
\
'stbName'
:
'stb'
,
\
'ctbNum'
:
10
,
\
'rowsPerTbl'
:
10
0
,
\
'batchNum'
:
10
,
\
'rowsPerTbl'
:
10
,
\
'batchNum'
:
200
,
\
'startTs'
:
1640966400000
}
# 2022-01-01 00:00:00.000
parameterDict
[
'cfg'
]
=
cfgPath
prepareEnvThread
=
threading
.
Thread
(
target
=
self
.
prepareEnv
,
kwargs
=
parameterDict
)
...
...
@@ -163,8 +163,7 @@ class TDTestCase:
tdSql
.
query
(
"create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)"
)
consumerId
=
0
expectmsgcnt
=
(
parameterDict
[
"rowsPerTbl"
]
/
parameterDict
[
"batchNum"
]
)
*
parameterDict
[
"ctbNum"
]
expectmsgcnt1
=
expectmsgcnt
+
parameterDict
[
"ctbNum"
]
expectrowcnt
=
parameterDict
[
"rowsPerTbl"
]
*
parameterDict
[
"ctbNum"
]
topicList
=
topicFromStb
ifcheckdata
=
0
keyList
=
'group.id:cgrp1,\
...
...
@@ -172,7 +171,7 @@ class TDTestCase:
auto.commit.interval.ms:6000,\
auto.offset.reset:earliest'
sql
=
"insert into consumeinfo values "
sql
+=
"(now, %d, '%s', '%s', %d, %d)"
%
(
consumerId
,
topicList
,
keyList
,
expect
msgcnt1
,
ifcheckdata
)
sql
+=
"(now, %d, '%s', '%s', %d, %d)"
%
(
consumerId
,
topicList
,
keyList
,
expect
rowcnt
,
ifcheckdata
)
tdSql
.
query
(
sql
)
tdLog
.
info
(
"check stb if there are data"
)
...
...
@@ -209,18 +208,20 @@ class TDTestCase:
else
:
time
.
sleep
(
5
)
expectrowcnt
=
parameterDict
[
"rowsPerTbl"
]
*
parameterDict
[
"ctbNum"
]
tdLog
.
info
(
"consumer result: %d, %d"
%
(
tdSql
.
getData
(
0
,
2
),
tdSql
.
getData
(
0
,
3
)))
tdSql
.
checkData
(
0
,
1
,
consumerId
)
tdSql
.
checkData
(
0
,
2
,
expectmsgcnt
)
# mulit rows and mulit tables in one sql, this num of msg is not sure
#tdSql.checkData(0 , 2, expectmsgcnt)
tdSql
.
checkData
(
0
,
3
,
expectrowcnt
)
tdSql
.
query
(
"drop topic %s"
%
topicFromStb
)
tdSql
.
query
(
"drop topic %s"
%
topicFromCtb
)
tdLog
.
printNoPrefix
(
"======== test case 1 end ...... "
)
def
tmqCase2
(
self
,
cfgPath
,
buildPath
):
tdLog
.
printNoPrefix
(
"======== test
scenario
2: add child table with consuming "
)
tdLog
.
printNoPrefix
(
"======== test
case
2: add child table with consuming "
)
# create and start thread
parameterDict
=
{
'cfg'
:
''
,
\
'dbName'
:
'db2'
,
\
...
...
@@ -275,9 +276,9 @@ class TDTestCase:
tdSql
.
query
(
"create table %s.consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int)"
%
cdbName
)
tdSql
.
query
(
"create table %s.consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)"
%
cdbName
)
rowsOfNewCtb
=
1000
consumerId
=
0
expectmsgcnt
=
(
parameterDict
[
"rowsPerTbl"
]
/
parameterDict
[
"batchNum"
]
)
*
parameterDict
[
"ctbNum"
]
expectmsgcnt1
=
expectmsgcnt
+
parameterDict
[
"ctbNum"
]
expectrowcnt
=
parameterDict
[
"rowsPerTbl"
]
*
parameterDict
[
"ctbNum"
]
+
rowsOfNewCtb
topicList
=
topicFromStb
ifcheckdata
=
0
keyList
=
'group.id:cgrp1,\
...
...
@@ -285,7 +286,7 @@ class TDTestCase:
auto.commit.interval.ms:6000,\
auto.offset.reset:earliest'
sql
=
"insert into consumeinfo values "
sql
+=
"(now, %d, '%s', '%s', %d, %d)"
%
(
consumerId
,
topicList
,
keyList
,
expect
msgcnt1
,
ifcheckdata
)
sql
+=
"(now, %d, '%s', '%s', %d, %d)"
%
(
consumerId
,
topicList
,
keyList
,
expect
rowcnt
,
ifcheckdata
)
tdSql
.
query
(
sql
)
tdLog
.
info
(
"check stb if there are data"
)
...
...
@@ -312,7 +313,6 @@ class TDTestCase:
# create new child table and insert data
newCtbName
=
'newctb'
rowsOfNewCtb
=
1000
tdSql
.
query
(
"create table %s.%s using %s.%s tags(9999)"
%
(
parameterDict
[
"dbName"
],
newCtbName
,
parameterDict
[
"dbName"
],
parameterDict
[
"stbName"
]))
startTs
=
parameterDict
[
"startTs"
]
for
j
in
range
(
rowsOfNewCtb
):
...
...
@@ -332,14 +332,13 @@ class TDTestCase:
else
:
time
.
sleep
(
5
)
expectmsgcnt
+=
rowsOfNewCtb
expectrowcnt
=
parameterDict
[
"rowsPerTbl"
]
*
parameterDict
[
"ctbNum"
]
+
rowsOfNewCtb
tdSql
.
checkData
(
0
,
1
,
consumerId
)
tdSql
.
checkData
(
0
,
2
,
expectmsgcnt
)
tdSql
.
checkData
(
0
,
3
,
expectrowcnt
)
tdSql
.
query
(
"drop topic %s"
%
topicFromStb
)
tdSql
.
query
(
"drop topic %s"
%
topicFromCtb
)
tdLog
.
printNoPrefix
(
"======== test
scenario
2 end ...... "
)
tdLog
.
printNoPrefix
(
"======== test
case
2 end ...... "
)
def
run
(
self
):
tdSql
.
prepare
()
...
...
tests/test/c/tmqSim.c
浏览文件 @
7bc5bb08
...
...
@@ -333,8 +333,8 @@ void loop_consume(SThreadInfo* pInfo) {
totalMsgs
++
;
if
(
total
Msg
s
>=
pInfo
->
expectMsgCnt
)
{
taosFprintfFile
(
g_fp
,
"==== total
Msg
s >= pInfo->expectMsgCnt, so break
\n
"
);
if
(
total
Row
s
>=
pInfo
->
expectMsgCnt
)
{
taosFprintfFile
(
g_fp
,
"==== total
Row
s >= pInfo->expectMsgCnt, so break
\n
"
);
break
;
}
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录