Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8152a769
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看板
提交
8152a769
编写于
8月 10, 2022
作者:
J
jiacy-jcy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update test case
上级
c95e9689
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
28 deletion
+28
-28
tests/system-test/2-query/Today.py
tests/system-test/2-query/Today.py
+12
-11
tests/system-test/2-query/top.py
tests/system-test/2-query/top.py
+16
-17
未找到文件。
tests/system-test/2-query/Today.py
浏览文件 @
8152a769
...
...
@@ -20,8 +20,9 @@ class TDTestCase:
self
.
arithmetic_operators
=
[
'+'
,
'-'
,
'*'
,
'/'
]
self
.
relational_operator
=
[
'<'
,
'<='
,
'='
,
'>='
,
'>'
]
# prepare data
self
.
ntbname
=
'ntb'
self
.
stbname
=
'stb'
self
.
dbname
=
'db'
self
.
ntbname
=
f
'
{
self
.
dbname
}
.ntb'
self
.
stbname
=
f
'
{
self
.
dbname
}
.stb'
self
.
column_dict
=
{
'ts'
:
'timestamp'
,
'c1'
:
'int'
,
...
...
@@ -96,7 +97,7 @@ class TDTestCase:
tdSql
.
checkRows
(
num_same
*
tb_num
)
elif
tb
==
'stb'
:
tdSql
.
checkRows
(
num_same
)
for
i
in
[
f
'
{
tbname
}
'
,
f
'db.
{
tbname
}
'
]:
for
i
in
[
f
'
{
tbname
}
'
]:
for
unit
in
self
.
time_unit
:
for
symbol
in
[
'+'
,
'-'
]:
tdSql
.
query
(
f
"select today()
{
symbol
}
1
{
unit
}
from
{
i
}
"
)
...
...
@@ -148,20 +149,20 @@ class TDTestCase:
tdSql
.
checkData
(
i
,
0
,
str
(
self
.
today_date
))
def
today_check_ntb
(
self
):
for
time_unit
in
self
.
db_percision
:
print
(
time_unit
)
tdSql
.
execute
(
f
'create database
db
precision "
{
time_unit
}
"'
)
tdSql
.
execute
(
'use db
'
)
tdSql
.
execute
(
f
'create database
{
self
.
dbname
}
precision "
{
time_unit
}
"'
)
tdSql
.
execute
(
f
'use
{
self
.
dbname
}
'
)
tdSql
.
execute
(
self
.
set_create_normaltable_sql
(
self
.
ntbname
,
self
.
column_dict
))
for
i
in
self
.
values_list
:
tdSql
.
execute
(
f
'insert into
{
self
.
ntbname
}
values(
{
i
}
)'
)
self
.
data_check
(
self
.
column_dict
,
self
.
ntbname
,
self
.
values_list
,
1
,
'tb'
,
time_unit
)
tdSql
.
execute
(
'drop database db
'
)
tdSql
.
execute
(
f
'drop database
{
self
.
dbname
}
'
)
def
today_check_stb_tb
(
self
):
for
time_unit
in
self
.
db_percision
:
print
(
time_unit
)
tdSql
.
execute
(
f
'create database
db
precision "
{
time_unit
}
"'
)
tdSql
.
execute
(
'use db
'
)
tdSql
.
execute
(
f
'create database
{
self
.
dbname
}
precision "
{
time_unit
}
"'
)
tdSql
.
execute
(
f
'use
{
self
.
dbname
}
'
)
tdSql
.
execute
(
self
.
set_create_stable_sql
(
self
.
stbname
,
self
.
column_dict
,
self
.
tag_dict
))
for
i
in
range
(
self
.
tbnum
):
tdSql
.
execute
(
f
'create table if not exists
{
self
.
stbname
}
_
{
i
}
using
{
self
.
stbname
}
tags(
{
self
.
tag_values
[
i
]
}
)'
)
...
...
@@ -172,7 +173,7 @@ class TDTestCase:
self
.
data_check
(
self
.
column_dict
,
f
'
{
self
.
stbname
}
_
{
i
}
'
,
self
.
values_list
,
1
,
'tb'
,
time_unit
)
# check stable
self
.
data_check
(
self
.
column_dict
,
self
.
stbname
,
self
.
values_list
,
self
.
tbnum
,
'stb'
,
time_unit
)
tdSql
.
execute
(
'drop database db
'
)
tdSql
.
execute
(
f
'drop database
{
self
.
dbname
}
'
)
def
run
(
self
):
# sourcery skip: extract-duplicate-method
...
...
tests/system-test/2-query/top.py
浏览文件 @
8152a769
...
...
@@ -23,7 +23,9 @@ class TDTestCase:
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
self
.
setsql
=
TDSetSql
()
self
.
ntbname
=
'ntb'
self
.
dbname
=
'db'
self
.
stbname
=
f
'
{
self
.
dbname
}
.stb'
self
.
ntbname
=
f
'
{
self
.
dbname
}
.ntb'
self
.
rowNum
=
10
self
.
tbnum
=
20
self
.
ts
=
1537146000000
...
...
@@ -96,52 +98,49 @@ class TDTestCase:
else
:
tdSql
.
checkRows
(
2
*
self
.
tbnum
)
def
top_check_stb
(
self
):
dbname
=
tdCom
.
getLongName
(
10
,
"letters"
)
stbname
=
tdCom
.
getLongName
(
5
,
"letters"
)
tag_dict
=
{
't0'
:
'int'
}
tag_values
=
[
f
'1'
]
tdSql
.
execute
(
f
"create database if not exists
{
dbname
}
vgroups 2"
)
tdSql
.
execute
(
f
'use
{
dbname
}
'
)
tdSql
.
execute
(
self
.
setsql
.
set_create_stable_sql
(
stbname
,
self
.
column_dict
,
tag_dict
))
tdSql
.
execute
(
f
"create database if not exists
{
self
.
dbname
}
vgroups 2"
)
tdSql
.
execute
(
f
'use
{
self
.
dbname
}
'
)
tdSql
.
execute
(
self
.
setsql
.
set_create_stable_sql
(
s
elf
.
s
tbname
,
self
.
column_dict
,
tag_dict
))
for
i
in
range
(
self
.
tbnum
):
tdSql
.
execute
(
f
"create table
{
s
tbname
}
_
{
i
}
using
{
stbname
}
tags(
{
tag_values
[
0
]
}
)"
)
self
.
insert_data
(
self
.
column_dict
,
f
'
{
stbname
}
_
{
i
}
'
,
self
.
rowNum
)
tdSql
.
query
(
'show
tables'
)
tdSql
.
execute
(
f
"create table
{
s
elf
.
stbname
}
_
{
i
}
using
{
self
.
stbname
}
tags(
{
tag_values
[
0
]
}
)"
)
self
.
insert_data
(
self
.
column_dict
,
f
'
{
s
elf
.
s
tbname
}
_
{
i
}
'
,
self
.
rowNum
)
tdSql
.
query
(
f
'show
{
self
.
dbname
}
.
tables'
)
vgroup_list
=
[]
for
i
in
range
(
len
(
tdSql
.
queryResult
)):
vgroup_list
.
append
(
tdSql
.
queryResult
[
i
][
6
])
vgroup_list_set
=
set
(
vgroup_list
)
for
i
in
vgroup_list_set
:
vgroups_num
=
vgroup_list
.
count
(
i
)
if
vgroups_num
>=
2
:
tdLog
.
info
(
f
'This scene with
{
vgroups_num
}
vgroups is ok!'
)
else
:
tdLog
.
exit
(
'This scene does not meet the requirements with {vgroups_num} vgroup!
\n
'
)
for
i
in
range
(
self
.
tbnum
):
self
.
top_check_data
(
f
'
{
stbname
}
_
{
i
}
'
,
'child_table'
)
self
.
top_check_data
(
stbname
,
'stable'
)
tdSql
.
execute
(
f
'drop database
{
dbname
}
'
)
self
.
top_check_data
(
f
'
{
s
elf
.
s
tbname
}
_
{
i
}
'
,
'child_table'
)
self
.
top_check_data
(
s
elf
.
s
tbname
,
'stable'
)
tdSql
.
execute
(
f
'drop database
{
self
.
dbname
}
'
)
def
top_check_ntb
(
self
):
tdSql
.
prepare
()
tdSql
.
execute
(
f
"create database if not exists
{
self
.
dbname
}
"
)
tdSql
.
execute
(
f
'use
{
self
.
dbname
}
'
)
tdSql
.
execute
(
self
.
setsql
.
set_create_normaltable_sql
(
self
.
ntbname
,
self
.
column_dict
))
self
.
insert_data
(
self
.
column_dict
,
self
.
ntbname
,
self
.
rowNum
)
self
.
top_check_data
(
self
.
ntbname
,
'normal_table'
)
tdSql
.
execute
(
'drop database db
'
)
tdSql
.
execute
(
f
'drop database
{
self
.
dbname
}
'
)
def
run
(
self
):
self
.
top_check_ntb
()
self
.
top_check_stb
()
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录