Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7eff0410
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看板
提交
7eff0410
编写于
6月 25, 2023
作者:
J
jiajingbin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: save
上级
da631dcb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
10 deletion
+13
-10
tests/system-test/7-tmq/tmqParamsTest.py
tests/system-test/7-tmq/tmqParamsTest.py
+13
-10
未找到文件。
tests/system-test/7-tmq/tmqParamsTest.py
浏览文件 @
7eff0410
...
@@ -21,11 +21,12 @@ class TDTestCase:
...
@@ -21,11 +21,12 @@ class TDTestCase:
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdSql
.
init
(
conn
.
cursor
())
tdSql
.
init
(
conn
.
cursor
())
self
.
commit_value_list
=
[
"true"
,
"false"
]
self
.
commit_value_list
=
[
"true"
,
"false"
]
self
.
reset_value_list
=
[
""
,
"earliest"
,
"latest"
,
"none"
]
self
.
offset_value_list
=
[
""
,
"earliest"
,
"latest"
,
"none"
]
self
.
offset_value_list
=
[
""
,
"earliest"
,
"none"
]
self
.
tbname_value_list
=
[
"true"
,
"false"
]
self
.
tbname_value_list
=
[
"true"
,
"false"
]
self
.
commit_value_list
=
[
"true"
]
self
.
commit_value_list
=
[
"true"
]
self
.
reset_value_list
=
[
"earli
est"
]
self
.
offset_value_list
=
[
"lat
est"
]
self
.
tbname_value_list
=
[
"true"
]
self
.
tbname_value_list
=
[
"true"
]
def
tmqParamsTest
(
self
):
def
tmqParamsTest
(
self
):
...
@@ -58,11 +59,12 @@ class TDTestCase:
...
@@ -58,11 +59,12 @@ class TDTestCase:
sqlString
=
"create topic %s as %s"
%
(
topic_name
,
queryString
)
sqlString
=
"create topic %s as %s"
%
(
topic_name
,
queryString
)
start_group_id
=
1
start_group_id
=
1
for
commit_value
in
self
.
commit_value_list
:
for
commit_value
in
self
.
commit_value_list
:
for
reset_value
in
self
.
re
set_value_list
:
for
offset_value
in
self
.
off
set_value_list
:
for
tbname_value
in
self
.
tbname_value_list
:
for
tbname_value
in
self
.
tbname_value_list
:
tdLog
.
info
(
"create topic sql: %s"
%
sqlString
)
tdLog
.
info
(
"create topic sql: %s"
%
sqlString
)
tdSql
.
execute
(
sqlString
)
tdSql
.
execute
(
sqlString
)
tdSql
.
query
(
queryString
)
tdSql
.
query
(
queryString
)
expected_res
=
tdSql
.
queryRows
group_id
=
"csm_"
+
str
(
start_group_id
)
group_id
=
"csm_"
+
str
(
start_group_id
)
consumer_dict
=
{
consumer_dict
=
{
"group.id"
:
group_id
,
"group.id"
:
group_id
,
...
@@ -70,18 +72,19 @@ class TDTestCase:
...
@@ -70,18 +72,19 @@ class TDTestCase:
"td.connect.pass"
:
"taosdata"
,
"td.connect.pass"
:
"taosdata"
,
"auto.commit.interval.ms"
:
paraDict
[
"auto_commit_interval"
],
"auto.commit.interval.ms"
:
paraDict
[
"auto_commit_interval"
],
"enable.auto.commit"
:
commit_value
,
"enable.auto.commit"
:
commit_value
,
"auto.offset.reset"
:
re
set_value
,
"auto.offset.reset"
:
off
set_value
,
"msg.with.table.name"
:
tbname_value
"msg.with.table.name"
:
tbname_value
}
}
print
(
consumer_dict
)
consumer_commit
=
1
if
consumer_dict
[
"enable.auto.commit"
]
==
"true"
else
0
consumer_commit
=
1
if
consumer_dict
[
"enable.auto.commit"
]
==
"true"
else
0
consumer_tbname
=
1
if
consumer_dict
[
"msg.with.table.name"
]
==
"true"
else
0
consumer_tbname
=
1
if
consumer_dict
[
"msg.with.table.name"
]
==
"true"
else
0
consumer_ret
=
"earliest"
if
reset_value
==
""
else
re
set_value
consumer_ret
=
"earliest"
if
offset_value
==
""
else
off
set_value
expected_parameters
=
f
'tbname:
{
consumer_tbname
}
,commit:
{
consumer_commit
}
,interval:
{
paraDict
[
"auto_commit_interval"
]
}
,reset:
{
consumer_ret
}
'
expected_parameters
=
f
'tbname:
{
consumer_tbname
}
,commit:
{
consumer_commit
}
,interval:
{
paraDict
[
"auto_commit_interval"
]
}
,reset:
{
consumer_ret
}
'
if
len
(
re
set_value
)
==
0
:
if
len
(
off
set_value
)
==
0
:
del
consumer_dict
[
"auto.offset.reset"
]
del
consumer_dict
[
"auto.offset.reset"
]
print
(
consumer_dict
)
consumer
=
Consumer
(
consumer_dict
)
consumer
=
Consumer
(
consumer_dict
)
consumer
.
subscribe
([
topic_name
])
consumer
.
subscribe
([
topic_name
])
tmqCom
.
insert_data
(
tdSql
,
paraDict
[
"dbName"
],
paraDict
[
"ctbPrefix"
],
paraDict
[
"ctbNum"
],
paraDict
[
"rowsPerTbl"
],
paraDict
[
"batchNum"
],
int
(
round
(
time
.
time
()
*
1000
)))
try
:
try
:
while
True
:
while
True
:
res
=
consumer
.
poll
(
1
)
res
=
consumer
.
poll
(
1
)
...
@@ -92,8 +95,7 @@ class TDTestCase:
...
@@ -92,8 +95,7 @@ class TDTestCase:
err
=
res
.
error
()
err
=
res
.
error
()
if
err
is
not
None
:
if
err
is
not
None
:
raise
err
raise
err
val
=
res
.
value
()
# val = res.value()
# for block in val:
# for block in val:
# print(block.fetchall())
# print(block.fetchall())
finally
:
finally
:
...
@@ -104,11 +106,12 @@ class TDTestCase:
...
@@ -104,11 +106,12 @@ class TDTestCase:
tdSql
.
query
(
'show subscriptions;'
)
tdSql
.
query
(
'show subscriptions;'
)
subscription_info
=
tdSql
.
queryResult
subscription_info
=
tdSql
.
queryResult
offset_value_list
=
list
(
map
(
lambda
x
:
int
(
x
[
-
2
].
replace
(
"log:"
,
""
)),
subscription_info
))
offset_value_list
=
list
(
map
(
lambda
x
:
int
(
x
[
-
2
].
replace
(
"log:"
,
""
)),
subscription_info
))
tdSql
.
checkEqual
(
sum
(
offset_value_list
)
>
0
,
True
)
print
(
offset_value_list
)
print
(
offset_value_list
)
rows_value_list
=
list
(
map
(
lambda
x
:
int
(
x
[
-
1
]),
subscription_info
))
rows_value_list
=
list
(
map
(
lambda
x
:
int
(
x
[
-
1
]),
subscription_info
))
print
(
rows_value_list
)
print
(
rows_value_list
)
tdSql
.
checkEqual
(
sum
(
rows_value_list
),
expected_res
)
tdSql
.
execute
(
f
"drop topic if exists
{
topic_name
}
"
)
tdSql
.
execute
(
f
"drop topic if exists
{
topic_name
}
"
)
return
def
run
(
self
):
def
run
(
self
):
self
.
tmqParamsTest
()
self
.
tmqParamsTest
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录