Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f1454669
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看板
提交
f1454669
编写于
11月 29, 2021
作者:
W
wenzhouwww
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change test case for CI for dump data into databases
上级
0b01819d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
98 addition
and
119 deletion
+98
-119
tests/pytest/client/taoshellCheckCase.py
tests/pytest/client/taoshellCheckCase.py
+32
-15
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+2
-2
tests/pytest/tools/taosdumpTestNanoSupport.py
tests/pytest/tools/taosdumpTestNanoSupport.py
+64
-102
未找到文件。
tests/pytest/client/taoshellCheckCase.py
浏览文件 @
f1454669
...
...
@@ -99,26 +99,41 @@ class TDTestCase:
else
:
shutil
.
rmtree
(
"./dumpdata"
)
os
.
mkdir
(
"./dumpdata"
)
os
.
system
(
build_path
+
"/"
+
"taosdump -D test -o ./dumpdata"
)
sleep
(
2
)
os
.
system
(
"cd ./dumpdata && mv dbs.sql tables.sql"
)
os
.
system
(
'sed -i "s/test/dumptest/g" `grep test -rl ./dumpdata`'
)
os
.
system
(
build_path
+
"/"
+
"taos -D ./dumpdata"
)
tdSql
.
query
(
"select count(*) from dumptest.st"
)
tdSql
.
checkData
(
0
,
0
,
50
)
tdLog
.
info
(
"========test other file name about tables.sql========"
)
os
.
system
(
"rm -rf ./dumpdata/*"
)
os
.
system
(
build_path
+
"/"
+
"taosdump -D test -o ./dumpdata"
)
sleep
(
2
)
os
.
system
(
"cd ./dumpdata && mv dbs.sql table.sql"
)
os
.
system
(
'sed -i "s/test/tt/g" `grep test -rl ./dumpdata`'
)
# write data into sqls file
tables
=
[
"CREATE DATABASE IF NOT EXISTS opendbtest REPLICA 1 QUORUM 1 DAYS
\
10 KEEP 3650 CACHE 16 BLOCKS 16 MINROWS 100 MAXROWS 4096 FSYNC 3000 CACHELAST 0 COMP 2 PRECISION 'ms' UPDATE 0;"
,
"CREATE TABLE IF NOT EXISTS opendbtest.cpus (ts TIMESTAMP, value DOUBLE) TAGS (author NCHAR(2),
\
department NCHAR(7), env NCHAR(4), hostname NCHAR(5), os NCHAR(6), production NCHAR(8),
\
team NCHAR(7), type NCHAR(10), useage NCHAR(7), workflow NCHAR(4));"
]
with
open
(
"./dumpdata/tables.sql"
,
"a"
)
as
f
:
for
item
in
tables
:
f
.
write
(
item
)
f
.
write
(
"
\n
"
)
f
.
close
()
records
=
[
"CREATE TABLE IF NOT EXISTS opendbtest.tb USING opendbtest.cpus TAGS ('dd', 'Beijing', 'test', 'vm_7', 'ubuntu', 'taosdata', 'develop', 'usage_user', 'monitor', 'TIMI');"
,
"INSERT INTO opendbtest.tb VALUES (1420070400000, 59.078475);"
,
"INSERT INTO opendbtest.tb VALUES (1420070410000, 44.844490);"
,
"INSERT INTO opendbtest.tb VALUES (1420070420000, 34.796703);"
,
"INSERT INTO opendbtest.tb VALUES (1420070430000, 35.758099);"
,
"INSERT INTO opendbtest.tb VALUES (1420070440000, 51.502387);"
]
with
open
(
"./dumpdata/opendbtest.0.sql"
,
"a"
)
as
f
:
for
item
in
records
:
f
.
write
(
item
)
f
.
write
(
"
\n
"
)
f
.
close
()
cmd
=
build_path
+
"/"
+
"taos -D ./dumpdata"
out
=
subprocess
.
Popen
(
cmd
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
).
stderr
.
read
().
decode
(
"utf-8"
)
if
out
.
find
(
"error:"
)
>=
0
:
print
(
"===========expected error occured======"
)
tdSql
.
query
(
"select value from opendbtest.tb"
)
tdSql
.
checkRows
(
5
)
tdLog
.
info
(
"====== check taos shell params ========"
)
...
...
@@ -162,6 +177,7 @@ class TDTestCase:
continue
else
:
cmd
=
build_path
+
"/"
+
"taos -s
\"
insert into dbst.tb2 values(now ,2,2.0,'"
+
code
+
"','汉字"
+
code
+
"
\'
)
\"
"
print
(
cmd
)
self
.
execute_cmd
(
cmd
)
...
...
@@ -192,6 +208,7 @@ class TDTestCase:
for
query
in
querys
:
cmd
=
build_path
+
"/"
+
"taos -s
\"
"
+
query
+
"
\"
"
self
.
execute_cmd
(
cmd
)
print
(
cmd
)
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/pytest/fulltest.sh
浏览文件 @
f1454669
...
...
@@ -182,7 +182,7 @@ python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoIns
python3 test.py
-f
tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoQuery.py
python3 test.py
-f
tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanosubscribe.py
python3 test.py
-f
tools/taosdemoAllTest/NanoTestCase/taosdemoTestInsertTime_step.py
# disable due to taosdump don't support sql format.
python3 test.py -f tools/taosdumpTestNanoSupport.py
python3 test.py
-f
tools/taosdumpTestNanoSupport.py
#
python3 ./test.py
-f
tsdb/tsdbComp.py
...
...
@@ -305,7 +305,7 @@ python3 ./test.py -f client/client.py
python3 ./test.py
-f
client/version.py
python3 ./test.py
-f
client/alterDatabase.py
python3 ./test.py
-f
client/noConnectionErrorTest.py
# disable due to taosdump don't support sql format.
python3 ./test.py -f client/taoshellCheckCase.py
python3 ./test.py
-f
client/taoshellCheckCase.py
# python3 test.py -f client/change_time_1_1.py
# python3 test.py -f client/change_time_1_2.py
...
...
tests/pytest/tools/taosdumpTestNanoSupport.py
浏览文件 @
f1454669
...
...
@@ -143,59 +143,41 @@ class TDTestCase:
'%staosdump --databases timedb1 -S 1625068810000000000 -o ./taosdumptest/dumptmp3 '
%
binPath
)
# replace strings to dump in databases
os
.
system
(
"sed -i
\"
s/timedb1/dumptmp1/g
\"
`grep timedb1 -rl ./taosdumptest/dumptmp1`"
)
os
.
system
(
"sed -i
\"
s/timedb1/dumptmp2/g
\"
`grep timedb1 -rl ./taosdumptest/dumptmp2`"
)
os
.
system
(
"sed -i
\"
s/timedb1/dumptmp3/g
\"
`grep timedb1 -rl ./taosdumptest/dumptmp3`"
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp1"
%
binPath
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp2"
%
binPath
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp3"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from dumptmp1.st"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
tdSql
.
query
(
"select count(*) from dumptmp2.st"
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from timedb1.st"
)
tdSql
.
checkData
(
0
,
0
,
510
)
tdSql
.
query
(
"select count(*) from dumptmp3.st"
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp3"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from timedb1.st"
)
tdSql
.
checkData
(
0
,
0
,
900
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from timedb1.st"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
# check data
origin_res
=
tdSql
.
getResult
(
"select * from timedb1.st"
)
dump_res
=
tdSql
.
getResult
(
"select * from dumptmp1.st"
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
dump_res
=
tdSql
.
getResult
(
"select * from timedb1.st"
)
if
origin_res
==
dump_res
:
tdLog
.
info
(
"test nano second : dump check data pass for all data!"
)
else
:
tdLog
.
info
(
"test nano second : dump check data failed for all data!"
)
origin_res
=
tdSql
.
getResult
(
"select * from timedb1.st where ts >=1625068810000000000 and ts <= 1625068860000000000"
)
dump_res
=
tdSql
.
getResult
(
"select * from dumptmp2.st"
)
if
origin_res
==
dump_res
:
tdLog
.
info
(
" test nano second : dump check data pass for data! "
)
else
:
tdLog
.
info
(
" test nano second : dump check data failed for data !"
)
origin_res
=
tdSql
.
getResult
(
"select * from timedb1.st where ts >=1625068810000000000 "
)
dump_res
=
tdSql
.
getResult
(
"select * from dumptmp3.st"
)
if
origin_res
==
dump_res
:
tdLog
.
info
(
" test nano second : dump check data pass for data! "
)
else
:
tdLog
.
info
(
" test nano second : dump check data failed for data !"
)
# us second support test case
os
.
system
(
"rm -rf ./taosdumptest/"
)
tdSql
.
execute
(
"drop database if exists dumptmp1"
)
tdSql
.
execute
(
"drop database if exists dumptmp2"
)
tdSql
.
execute
(
"drop database if exists dumptmp3"
)
tdSql
.
execute
(
"drop database if exists timedb1"
)
if
not
os
.
path
.
exists
(
"./taosdumptest/tmp1"
):
os
.
makedirs
(
"./taosdumptest/dumptmp1"
)
...
...
@@ -228,55 +210,44 @@ class TDTestCase:
'%staosdump --databases timedb1 -S 1625068810000000 -o ./taosdumptest/dumptmp3 '
%
binPath
)
os
.
system
(
"sed -i
\"
s/timedb1/dumptmp1/g
\"
`grep timedb1 -rl ./taosdumptest/dumptmp1`"
)
os
.
system
(
"sed -i
\"
s/timedb1/dumptmp2/g
\"
`grep timedb1 -rl ./taosdumptest/dumptmp2`"
)
os
.
system
(
"sed -i
\"
s/timedb1/dumptmp3/g
\"
`grep timedb1 -rl ./taosdumptest/dumptmp3`"
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp1"
%
binPath
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp2"
%
binPath
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp3"
%
binPath
)
tdSql
.
query
(
"select count(*) from dumptmp1.st
"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
tdSql
.
query
(
"select count(*) from
dumptmp2
.st"
)
tdSql
.
execute
(
"drop database timedb1
"
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp2"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from
timedb1
.st"
)
tdSql
.
checkData
(
0
,
0
,
510
)
tdSql
.
query
(
"select count(*) from dumptmp3.st"
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp3"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from timedb1.st"
)
tdSql
.
checkData
(
0
,
0
,
900
)
origin_res
=
tdSql
.
getResult
(
"select * from timedb1.st"
)
dump_res
=
tdSql
.
getResult
(
"select * from dumptmp1.st"
)
if
origin_res
==
dump_res
:
tdLog
.
info
(
"test us second : dump check data pass for all data!"
)
else
:
tdLog
.
info
(
"test us second : dump check data failed for all data!"
)
origin_res
=
tdSql
.
getResult
(
"select * from timedb1.st where ts >=1625068810000000 and ts <= 1625068860000000"
)
dump_res
=
tdSql
.
getResult
(
"select * from dumptmp2.st"
)
if
origin_res
==
dump_res
:
tdLog
.
info
(
" test us second : dump check data pass for data! "
)
else
:
tdLog
.
info
(
" test us second : dump check data failed for data!"
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from timedb1.st"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
origin_res
=
tdSql
.
getResult
(
"select * from timedb1.st where ts >=1625068810000000 "
)
dump_res
=
tdSql
.
getResult
(
"select * from dumptmp3.st"
)
# check data
origin_res
=
tdSql
.
getResult
(
"select * from timedb1.st"
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
dump_res
=
tdSql
.
getResult
(
"select * from timedb1.st"
)
if
origin_res
==
dump_res
:
tdLog
.
info
(
"
test us second : dump check data pass for data!
"
)
tdLog
.
info
(
"
test micro second : dump check data pass for all data!
"
)
else
:
tdLog
.
info
(
" test us second : dump check data failed for data! "
)
tdLog
.
info
(
"test micro second : dump check data failed for all data!"
)
# ms second support test case
os
.
system
(
"rm -rf ./taosdumptest/"
)
tdSql
.
execute
(
"drop database if exists dumptmp1"
)
tdSql
.
execute
(
"drop database if exists dumptmp2"
)
tdSql
.
execute
(
"drop database if exists dumptmp3"
)
tdSql
.
execute
(
"drop database if exists timedb1"
)
if
not
os
.
path
.
exists
(
"./taosdumptest/tmp1"
):
os
.
makedirs
(
"./taosdumptest/dumptmp1"
)
...
...
@@ -309,48 +280,39 @@ class TDTestCase:
'%staosdump --databases timedb1 -S 1625068810000 -o ./taosdumptest/dumptmp3 '
%
binPath
)
os
.
system
(
"sed -i
\"
s/timedb1/dumptmp1/g
\"
`grep timedb1 -rl ./taosdumptest/dumptmp1`"
)
os
.
system
(
"sed -i
\"
s/timedb1/dumptmp2/g
\"
`grep timedb1 -rl ./taosdumptest/dumptmp2`"
)
os
.
system
(
"sed -i
\"
s/timedb1/dumptmp3/g
\"
`grep timedb1 -rl ./taosdumptest/dumptmp3`"
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp1"
%
binPath
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp2"
%
binPath
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp3"
%
binPath
)
tdSql
.
query
(
"select count(*) from dumptmp1.st
"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
tdSql
.
query
(
"select count(*) from
dumptmp2
.st"
)
tdSql
.
execute
(
"drop database timedb1
"
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp2"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from
timedb1
.st"
)
tdSql
.
checkData
(
0
,
0
,
510
)
tdSql
.
query
(
"select count(*) from dumptmp3.st"
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp3"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from timedb1.st"
)
tdSql
.
checkData
(
0
,
0
,
900
)
origin_res
=
tdSql
.
getResult
(
"select * from timedb1.st"
)
dump_res
=
tdSql
.
getResult
(
"select * from dumptmp1.st"
)
if
origin_res
==
dump_res
:
tdLog
.
info
(
"test ms second : dump check data pass for all data!"
)
else
:
tdLog
.
info
(
"test ms second : dump check data failed for all data!"
)
origin_res
=
tdSql
.
getResult
(
"select * from timedb1.st where ts >=1625068810000 and ts <= 1625068860000"
)
dump_res
=
tdSql
.
getResult
(
"select * from dumptmp2.st"
)
if
origin_res
==
dump_res
:
tdLog
.
info
(
" test ms second : dump check data pass for data! "
)
else
:
tdLog
.
info
(
" test ms second : dump check data failed for data!"
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
tdSql
.
query
(
"select count(*) from timedb1.st"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
origin_res
=
tdSql
.
getResult
(
"select * from timedb1.st where ts >=1625068810000 "
)
dump_res
=
tdSql
.
getResult
(
"select * from dumptmp3.st"
)
# check data
origin_res
=
tdSql
.
getResult
(
"select * from timedb1.st"
)
tdSql
.
execute
(
"drop database timedb1"
)
os
.
system
(
"%staosdump -i ./taosdumptest/dumptmp1"
%
binPath
)
# dump data and check for taosdump
dump_res
=
tdSql
.
getResult
(
"select * from timedb1.st"
)
if
origin_res
==
dump_res
:
tdLog
.
info
(
"
test ms second : dump check data pass for data!
"
)
tdLog
.
info
(
"
test million second : dump check data pass for all data!
"
)
else
:
tdLog
.
info
(
" test ms second : dump check data failed for data! "
)
tdLog
.
info
(
"test million second : dump check data failed for all data!"
)
os
.
system
(
"rm -rf ./taosdumptest/"
)
os
.
system
(
"rm -rf ./dump_result.txt"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录