Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5d3e4050
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5d3e4050
编写于
5月 25, 2023
作者:
C
chao.feng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update the test case by charles
上级
8e735dc6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
70 addition
and
0 deletion
+70
-0
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+1
-0
tests/system-test/2-query/ts_3423.py
tests/system-test/2-query/ts_3423.py
+69
-0
未找到文件。
tests/parallel_test/cases.task
浏览文件 @
5d3e4050
...
@@ -344,6 +344,7 @@
...
@@ -344,6 +344,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ts_3398.py -N 3 -n 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ts_3398.py -N 3 -n 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ts_3405.py -N 3 -n 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ts_3405.py -N 3 -n 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ts_3423.py -N 3 -n 3
,,n,system-test,python3 ./test.py -f 2-query/queryQnode.py
,,n,system-test,python3 ./test.py -f 2-query/queryQnode.py
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode1mnode.py
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode1mnode.py
...
...
tests/system-test/2-query/ts_3423.py
0 → 100644
浏览文件 @
5d3e4050
from
util.log
import
*
from
util.sql
import
*
from
util.cases
import
*
from
util.sqlset
import
*
import
datetime
import
random
class
TDTestCase
:
"""This test case is used to verify last(*) query result is correct when the data
is group by tag for stable
"""
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
self
.
replicaVar
=
int
(
replicaVar
)
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
False
)
def
run
(
self
):
# test case for https://jira.taosdata.com:18080/browse/TS-3423:
# create db
ret
=
tdSql
.
execute
(
"CREATE DATABASE IF NOT EXISTS ts_3423 REPLICA {} DURATION 14400m KEEP 5256000m,5256000m,5256000m PRECISION 'ms' MINROWS 100 MAXROWS 4096 COMP 2;"
.
format
(
self
.
replicaVar
))
tdSql
.
execute
(
"use ts_3423;"
)
# create stable
ret
=
tdSql
.
execute
(
"CREATE STABLE IF NOT EXISTS ts_3423.`st_last`(`ts` timestamp,`n1` int,`n2` float) TAGS(`groupname` binary(32));"
)
# insert the data to table
insertRows
=
10
child_table_num
=
10
for
i
in
range
(
insertRows
):
ts
=
datetime
.
datetime
.
strptime
(
'2023-05-01 00:00:00.000'
,
'%Y-%m-%d %H:%M:%S.%f'
)
+
datetime
.
timedelta
(
seconds
=
i
)
for
j
in
range
(
child_table_num
):
ret
=
tdSql
.
execute
(
"insert into {} using ts_3423.`st_last` tags('{}') values ('{}', {}, {})"
.
format
(
"d"
+
str
(
j
),
"group"
+
str
(
j
),
str
(
ts
),
str
(
i
+
1
),
random
.
random
()))
tdLog
.
info
(
"insert %d rows for every child table"
%
(
insertRows
))
# cache model list
cache_model
=
[
"none"
,
"last_row"
,
"last_value"
,
"both"
]
query_res
=
[]
# execute the sql statements first
ret
=
tdSql
.
query
(
"select `cachemodel` from information_schema.ins_databases where name='ts_3423'"
)
current_cache_model
=
tdSql
.
queryResult
[
0
][
0
]
tdLog
.
info
(
"query on cache model {}"
.
format
(
current_cache_model
))
ret
=
tdSql
.
query
(
"select last(*) from st_last group by groupname;"
)
# save the results
query_res
.
append
(
len
(
tdSql
.
queryResult
))
# remove the current cache model
cache_model
.
remove
(
current_cache_model
)
for
item
in
cache_model
:
tdSql
.
execute
(
"alter database ts_3423 cachemodel '{}';"
.
format
(
item
))
# execute the sql statements
ret
=
tdSql
.
query
(
"select last(*) from st_last group by groupname;"
)
tdLog
.
info
(
"query on cache model {}"
.
format
(
item
))
query_res
.
append
(
len
(
tdSql
.
queryResult
))
# check the result
res
=
True
if
query_res
.
count
(
child_table_num
)
==
4
else
False
if
res
:
tdLog
.
info
(
"query result is correct and same among different cache model"
)
else
:
tdLog
.
info
(
"query result is wrong"
)
def
stop
(
self
):
# clear the db
tdSql
.
execute
(
"drop database if exists ts_3423;"
)
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录