Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
dedbb754
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
dedbb754
编写于
7月 20, 2021
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into feature/td-4647-2
上级
ff7aec3b
e8b3fde4
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
342 addition
and
340 deletion
+342
-340
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+195
-193
tests/pytest/query/query1970YearsAf.py
tests/pytest/query/query1970YearsAf.py
+4
-4
tests/pytest/tools/taosdemoAllTest/TD-4985/query-limit-offset.py
...ytest/tools/taosdemoAllTest/TD-4985/query-limit-offset.py
+27
-27
tests/pytest/tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.py
.../tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.py
+19
-19
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
...ytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
+77
-77
tests/pytest/tools/taosdemoTest.py
tests/pytest/tools/taosdemoTest.py
+2
-2
tests/pytest/wal/sdbComp.py
tests/pytest/wal/sdbComp.py
+18
-18
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
dedbb754
此差异已折叠。
点击以展开。
tests/pytest/query/query1970YearsAf.py
浏览文件 @
dedbb754
...
@@ -187,19 +187,19 @@ class TDTestCase:
...
@@ -187,19 +187,19 @@ class TDTestCase:
"select * from t9 where t9.ts > '1969-12-31 22:00:00.000' and t9.ts <'1970-01-01 02:00:00.000' "
"select * from t9 where t9.ts > '1969-12-31 22:00:00.000' and t9.ts <'1970-01-01 02:00:00.000' "
)
)
tdSql
.
checkRows
(
719
)
tdSql
.
checkRows
(
719
)
tdSql
.
query
(
tdSql
.
query
(
"select * from t0,t1 where t0.ts=t1.ts and t1.ts >= '1970-01-01 00:00:00.000' "
"select * from t0,t1 where t0.ts=t1.ts and t1.ts >= '1970-01-01 00:00:00.000' "
)
)
tdSql
.
checkRows
(
680
)
tdSql
.
checkRows
(
680
)
tdSql
.
query
(
tdSql
.
query
(
"select diff(c
ol
1) from t0 where t0.ts >= '1970-01-01 00:00:00.000' "
"select diff(c1) from t0 where t0.ts >= '1970-01-01 00:00:00.000' "
)
)
tdSql
.
checkRows
(
679
)
tdSql
.
checkRows
(
679
)
tdSql
.
query
(
tdSql
.
query
(
"select t0,c
ol
1 from stb2 where stb2.ts < '1970-01-01 00:00:00.000' order by ts"
"select t0,c1 from stb2 where stb2.ts < '1970-01-01 00:00:00.000' order by ts"
)
)
tdSql
.
checkRows
(
43200
)
tdSql
.
checkRows
(
43200
)
...
...
tests/pytest/tools/taosdemoAllTest/TD-4985/query-limit-offset.py
浏览文件 @
dedbb754
...
@@ -23,7 +23,7 @@ class TDTestCase:
...
@@ -23,7 +23,7 @@ class TDTestCase:
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
getBuildPath
(
self
):
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
...
@@ -39,7 +39,7 @@ class TDTestCase:
...
@@ -39,7 +39,7 @@ class TDTestCase:
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
break
return
buildPath
return
buildPath
def
run
(
self
):
def
run
(
self
):
buildPath
=
self
.
getBuildPath
()
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
if
(
buildPath
==
""
):
...
@@ -48,7 +48,7 @@ class TDTestCase:
...
@@ -48,7 +48,7 @@ class TDTestCase:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
binPath
=
buildPath
+
"/build/bin/"
# insert: create one or mutiple tables per sql and insert multiple rows per sql
# insert: create one or mutiple tables per sql and insert multiple rows per sql
# test case for https://jira.taosdata.com:18080/browse/TD-4985
# test case for https://jira.taosdata.com:18080/browse/TD-4985
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/TD-4985/query-limit-offset.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/TD-4985/query-limit-offset.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
...
@@ -56,27 +56,27 @@ class TDTestCase:
...
@@ -56,27 +56,27 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
checkData
(
0
,
0
,
10000
)
for
i
in
range
(
1000
):
for
i
in
range
(
1000
):
tdSql
.
execute
(
'''insert into stb00_9999 values(%d, %d, %d,'test99.%s')'''
tdSql
.
execute
(
'''insert into stb00_9999 values(%d, %d, %d,'test99.%s')'''
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_8888 values(%d, %d, %d,'test98.%s')'''
tdSql
.
execute
(
'''insert into stb00_8888 values(%d, %d, %d,'test98.%s')'''
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_7777 values(%d, %d, %d,'test97.%s')'''
tdSql
.
execute
(
'''insert into stb00_7777 values(%d, %d, %d,'test97.%s')'''
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_6666 values(%d, %d, %d,'test96.%s')'''
tdSql
.
execute
(
'''insert into stb00_6666 values(%d, %d, %d,'test96.%s')'''
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_5555 values(%d, %d, %d,'test95.%s')'''
tdSql
.
execute
(
'''insert into stb00_5555 values(%d, %d, %d,'test95.%s')'''
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_4444 values(%d, %d, %d,'test94.%s')'''
tdSql
.
execute
(
'''insert into stb00_4444 values(%d, %d, %d,'test94.%s')'''
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_3333 values(%d, %d, %d,'test93.%s')'''
tdSql
.
execute
(
'''insert into stb00_3333 values(%d, %d, %d,'test93.%s')'''
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_2222 values(%d, %d, %d,'test92.%s')'''
tdSql
.
execute
(
'''insert into stb00_2222 values(%d, %d, %d,'test92.%s')'''
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_1111 values(%d, %d, %d,'test91.%s')'''
tdSql
.
execute
(
'''insert into stb00_1111 values(%d, %d, %d,'test91.%s')'''
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_100 values(%d, %d, %d,'test90.%s')'''
tdSql
.
execute
(
'''insert into stb00_100 values(%d, %d, %d,'test90.%s')'''
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
%
(
1600000000000
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
query
(
"select * from stb0 where c
ol
2 like 'test99%' "
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test99%' "
)
tdSql
.
checkRows
(
1000
)
tdSql
.
checkRows
(
1000
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_9999' limit 10"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_9999' limit 10"
)
tdSql
.
checkData
(
0
,
1
,
0
)
tdSql
.
checkData
(
0
,
1
,
0
)
...
@@ -86,7 +86,7 @@ class TDTestCase:
...
@@ -86,7 +86,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c
ol
2 like 'test98%' "
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test98%' "
)
tdSql
.
checkRows
(
1000
)
tdSql
.
checkRows
(
1000
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_8888' limit 10"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_8888' limit 10"
)
tdSql
.
checkData
(
0
,
1
,
0
)
tdSql
.
checkData
(
0
,
1
,
0
)
...
@@ -96,7 +96,7 @@ class TDTestCase:
...
@@ -96,7 +96,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c
ol
2 like 'test97%' "
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test97%' "
)
tdSql
.
checkRows
(
1000
)
tdSql
.
checkRows
(
1000
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_7777' limit 10"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_7777' limit 10"
)
tdSql
.
checkData
(
0
,
1
,
0
)
tdSql
.
checkData
(
0
,
1
,
0
)
...
@@ -106,7 +106,7 @@ class TDTestCase:
...
@@ -106,7 +106,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c
ol
2 like 'test96%' "
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test96%' "
)
tdSql
.
checkRows
(
1000
)
tdSql
.
checkRows
(
1000
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_6666' limit 10"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_6666' limit 10"
)
tdSql
.
checkData
(
0
,
1
,
0
)
tdSql
.
checkData
(
0
,
1
,
0
)
...
@@ -116,7 +116,7 @@ class TDTestCase:
...
@@ -116,7 +116,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c
ol
2 like 'test95%' "
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test95%' "
)
tdSql
.
checkRows
(
1000
)
tdSql
.
checkRows
(
1000
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_5555' limit 10"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_5555' limit 10"
)
tdSql
.
checkData
(
0
,
1
,
0
)
tdSql
.
checkData
(
0
,
1
,
0
)
...
@@ -126,7 +126,7 @@ class TDTestCase:
...
@@ -126,7 +126,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c
ol
2 like 'test94%' "
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test94%' "
)
tdSql
.
checkRows
(
1000
)
tdSql
.
checkRows
(
1000
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_4444' limit 10"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_4444' limit 10"
)
tdSql
.
checkData
(
0
,
1
,
0
)
tdSql
.
checkData
(
0
,
1
,
0
)
...
@@ -136,7 +136,7 @@ class TDTestCase:
...
@@ -136,7 +136,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c
ol
2 like 'test93%' "
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test93%' "
)
tdSql
.
checkRows
(
1000
)
tdSql
.
checkRows
(
1000
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_3333' limit 100"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_3333' limit 100"
)
tdSql
.
checkData
(
0
,
1
,
0
)
tdSql
.
checkData
(
0
,
1
,
0
)
...
@@ -146,7 +146,7 @@ class TDTestCase:
...
@@ -146,7 +146,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c
ol
2 like 'test92%' "
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test92%' "
)
tdSql
.
checkRows
(
1000
)
tdSql
.
checkRows
(
1000
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_2222' limit 100"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_2222' limit 100"
)
tdSql
.
checkData
(
0
,
1
,
0
)
tdSql
.
checkData
(
0
,
1
,
0
)
...
@@ -156,7 +156,7 @@ class TDTestCase:
...
@@ -156,7 +156,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c
ol
2 like 'test91%' "
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test91%' "
)
tdSql
.
checkRows
(
1000
)
tdSql
.
checkRows
(
1000
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_1111' limit 100"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_1111' limit 100"
)
tdSql
.
checkData
(
0
,
1
,
0
)
tdSql
.
checkData
(
0
,
1
,
0
)
...
@@ -166,7 +166,7 @@ class TDTestCase:
...
@@ -166,7 +166,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c
ol
2 like 'test90%' "
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test90%' "
)
tdSql
.
checkRows
(
1000
)
tdSql
.
checkRows
(
1000
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_100' limit 100"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_100' limit 100"
)
tdSql
.
checkData
(
0
,
1
,
0
)
tdSql
.
checkData
(
0
,
1
,
0
)
...
@@ -178,10 +178,10 @@ class TDTestCase:
...
@@ -178,10 +178,10 @@ class TDTestCase:
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
checkData
(
2
,
1
,
7
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/TD-4985/query-limit-offset.py.sql"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/TD-4985/query-limit-offset.py.sql"
)
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.py
浏览文件 @
dedbb754
...
@@ -23,7 +23,7 @@ class TDTestCase:
...
@@ -23,7 +23,7 @@ class TDTestCase:
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
getBuildPath
(
self
):
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
...
@@ -39,7 +39,7 @@ class TDTestCase:
...
@@ -39,7 +39,7 @@ class TDTestCase:
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
break
return
buildPath
return
buildPath
def
run
(
self
):
def
run
(
self
):
buildPath
=
self
.
getBuildPath
()
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
if
(
buildPath
==
""
):
...
@@ -48,7 +48,7 @@ class TDTestCase:
...
@@ -48,7 +48,7 @@ class TDTestCase:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
binPath
=
buildPath
+
"/build/bin/"
# insert: create one or mutiple tables per sql and insert multiple rows per sql
# insert: create one or mutiple tables per sql and insert multiple rows per sql
# test case for https://jira.taosdata.com:18080/browse/TD-5213
# test case for https://jira.taosdata.com:18080/browse/TD-5213
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
...
@@ -58,29 +58,29 @@ class TDTestCase:
...
@@ -58,29 +58,29 @@ class TDTestCase:
# tdSql.query("select * from stb_old")
# tdSql.query("select * from stb_old")
# tdSql.checkRows(10)
# tdSql.checkRows(10)
# tdSql.checkCols(1024)
# tdSql.checkCols(1024)
# tdSql.query("select count (tbname) from stb_new")
# tdSql.query("select count (tbname) from stb_new")
# tdSql.checkData(0, 0, 10)
# tdSql.checkData(0, 0, 10)
# tdSql.query("select * from stb_new")
# tdSql.query("select * from stb_new")
# tdSql.checkRows(10)
# tdSql.checkRows(10)
# tdSql.checkCols(4096)
# tdSql.checkCols(4096)
# tdLog.info("stop dnode to commit data to disk")
# tdLog.info("stop dnode to commit data to disk")
# tdDnodes.stop(1)
# tdDnodes.stop(1)
# tdDnodes.start(1)
# tdDnodes.start(1)
#regular table
#regular table
sql
=
"create table tb(ts timestamp, "
sql
=
"create table tb(ts timestamp, "
for
i
in
range
(
1022
):
for
i
in
range
(
1022
):
sql
+=
"c
ol
%d binary(14), "
%
(
i
+
1
)
sql
+=
"c%d binary(14), "
%
(
i
+
1
)
sql
+=
"c
ol1023 binary(22))"
sql
+=
"c
1023 binary(22))"
tdSql
.
execute
(
sql
)
tdSql
.
execute
(
sql
)
for
i
in
range
(
4
):
for
i
in
range
(
4
):
sql
=
"insert into tb values(%d, "
sql
=
"insert into tb values(%d, "
for
j
in
range
(
1022
):
for
j
in
range
(
1022
):
str
=
"'%s', "
%
self
.
get_random_string
(
14
)
str
=
"'%s', "
%
self
.
get_random_string
(
14
)
sql
+=
str
sql
+=
str
sql
+=
"'%s')"
%
self
.
get_random_string
(
22
)
sql
+=
"'%s')"
%
self
.
get_random_string
(
22
)
tdSql
.
execute
(
sql
%
(
self
.
ts
+
i
))
tdSql
.
execute
(
sql
%
(
self
.
ts
+
i
))
...
@@ -94,19 +94,19 @@ class TDTestCase:
...
@@ -94,19 +94,19 @@ class TDTestCase:
time
.
sleep
(
1
)
time
.
sleep
(
1
)
tdSql
.
query
(
"select count(*) from tb"
)
tdSql
.
query
(
"select count(*) from tb"
)
tdSql
.
checkData
(
0
,
0
,
4
)
tdSql
.
checkData
(
0
,
0
,
4
)
sql
=
"create table tb1(ts timestamp, "
sql
=
"create table tb1(ts timestamp, "
for
i
in
range
(
4094
):
for
i
in
range
(
4094
):
sql
+=
"c
ol
%d binary(14), "
%
(
i
+
1
)
sql
+=
"c%d binary(14), "
%
(
i
+
1
)
sql
+=
"c
ol4095 binary(22))"
sql
+=
"c
4095 binary(22))"
tdSql
.
execute
(
sql
)
tdSql
.
execute
(
sql
)
for
i
in
range
(
4
):
for
i
in
range
(
4
):
sql
=
"insert into tb1 values(%d, "
sql
=
"insert into tb1 values(%d, "
for
j
in
range
(
4094
):
for
j
in
range
(
4094
):
str
=
"'%s', "
%
self
.
get_random_string
(
14
)
str
=
"'%s', "
%
self
.
get_random_string
(
14
)
sql
+=
str
sql
+=
str
sql
+=
"'%s')"
%
self
.
get_random_string
(
22
)
sql
+=
"'%s')"
%
self
.
get_random_string
(
22
)
tdSql
.
execute
(
sql
%
(
self
.
ts
+
i
))
tdSql
.
execute
(
sql
%
(
self
.
ts
+
i
))
...
@@ -120,14 +120,14 @@ class TDTestCase:
...
@@ -120,14 +120,14 @@ class TDTestCase:
time
.
sleep
(
1
)
time
.
sleep
(
1
)
tdSql
.
query
(
"select count(*) from tb1"
)
tdSql
.
query
(
"select count(*) from tb1"
)
tdSql
.
checkData
(
0
,
0
,
4
)
tdSql
.
checkData
(
0
,
0
,
4
)
#os.system("rm -rf tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.py.sql")
#os.system("rm -rf tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.py.sql")
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
浏览文件 @
dedbb754
...
@@ -23,7 +23,7 @@ class TDTestCase:
...
@@ -23,7 +23,7 @@ class TDTestCase:
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
getBuildPath
(
self
):
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
...
@@ -39,7 +39,7 @@ class TDTestCase:
...
@@ -39,7 +39,7 @@ class TDTestCase:
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
break
return
buildPath
return
buildPath
def
run
(
self
):
def
run
(
self
):
buildPath
=
self
.
getBuildPath
()
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
if
(
buildPath
==
""
):
...
@@ -48,7 +48,7 @@ class TDTestCase:
...
@@ -48,7 +48,7 @@ class TDTestCase:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
binPath
=
buildPath
+
"/build/bin/"
# insert: create one or mutiple tables per sql and insert multiple rows per sql
# insert: create one or mutiple tables per sql and insert multiple rows per sql
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-1s1tnt1r.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-1s1tnt1r.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
...
@@ -62,7 +62,7 @@ class TDTestCase:
...
@@ -62,7 +62,7 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from stb01_1"
)
tdSql
.
query
(
"select count(*) from stb01_1"
)
tdSql
.
checkData
(
0
,
0
,
200
)
tdSql
.
checkData
(
0
,
0
,
200
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
200000
)
tdSql
.
checkData
(
0
,
0
,
200000
)
# restful connector insert data
# restful connector insert data
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertRestful.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertRestful.json -y "
%
binPath
)
...
@@ -81,7 +81,7 @@ class TDTestCase:
...
@@ -81,7 +81,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
200
)
tdSql
.
checkData
(
0
,
0
,
200
)
# insert: create mutiple tables per sql and insert one rows per sql .
# insert: create mutiple tables per sql and insert one rows per sql .
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-1s1tntmr.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-1s1tntmr.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
...
@@ -89,34 +89,34 @@ class TDTestCase:
...
@@ -89,34 +89,34 @@ class TDTestCase:
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
20
)
tdSql
.
checkData
(
0
,
0
,
20
)
tdSql
.
query
(
"select count(*) from stb00_0"
)
tdSql
.
query
(
"select count(*) from stb00_0"
)
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
100000
)
tdSql
.
checkData
(
0
,
0
,
100000
)
tdSql
.
query
(
"select count(*) from stb01_0"
)
tdSql
.
query
(
"select count(*) from stb01_0"
)
tdSql
.
checkData
(
0
,
0
,
20000
)
tdSql
.
checkData
(
0
,
0
,
20000
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
400000
)
tdSql
.
checkData
(
0
,
0
,
400000
)
# insert: using parament "insert_interval to controls spped of insert.
# insert: using parament "insert_interval to controls spped of insert.
# but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。
# but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-interval-speed.json -y"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-interval-speed.json -y"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
100
)
tdSql
.
checkData
(
0
,
4
,
100
)
tdSql
.
query
(
"select count(*) from stb00_0"
)
tdSql
.
query
(
"select count(*) from stb00_0"
)
tdSql
.
checkData
(
0
,
0
,
20000
)
tdSql
.
checkData
(
0
,
0
,
20000
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
2000000
)
tdSql
.
checkData
(
0
,
0
,
2000000
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
1
,
4
,
100
)
tdSql
.
checkData
(
1
,
4
,
100
)
tdSql
.
query
(
"select count(*) from stb01_0"
)
tdSql
.
query
(
"select count(*) from stb01_0"
)
tdSql
.
checkData
(
0
,
0
,
20000
)
tdSql
.
checkData
(
0
,
0
,
20000
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
2000000
)
tdSql
.
checkData
(
0
,
0
,
2000000
)
# spend 2min30s for 3 testcases.
# spend 2min30s for 3 testcases.
# insert: drop and child_table_exists combination test
# insert: drop and child_table_exists combination test
# insert: using parament "childtable_offset and childtable_limit" to control table'offset point and offset
# insert: using parament "childtable_offset and childtable_limit" to control table'offset point and offset
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-nodbnodrop.json -y"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-nodbnodrop.json -y"
%
binPath
)
tdSql
.
error
(
"show dbno.stables"
)
tdSql
.
error
(
"show dbno.stables"
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-newdb.json -y"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-newdb.json -y"
%
binPath
)
...
@@ -128,41 +128,41 @@ class TDTestCase:
...
@@ -128,41 +128,41 @@ class TDTestCase:
tdSql
.
query
(
"select count (tbname) from stb2"
)
tdSql
.
query
(
"select count (tbname) from stb2"
)
tdSql
.
checkData
(
0
,
0
,
7
)
tdSql
.
checkData
(
0
,
0
,
7
)
tdSql
.
query
(
"select count (tbname) from stb3"
)
tdSql
.
query
(
"select count (tbname) from stb3"
)
tdSql
.
checkData
(
0
,
0
,
8
)
tdSql
.
checkData
(
0
,
0
,
8
)
tdSql
.
query
(
"select count (tbname) from stb4"
)
tdSql
.
query
(
"select count (tbname) from stb4"
)
tdSql
.
checkData
(
0
,
0
,
8
)
tdSql
.
checkData
(
0
,
0
,
8
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-offset.json -y"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-offset.json -y"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
50
)
tdSql
.
checkData
(
0
,
0
,
50
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
240
)
tdSql
.
checkData
(
0
,
0
,
240
)
tdSql
.
query
(
"select count(*) from stb2"
)
tdSql
.
query
(
"select count(*) from stb2"
)
tdSql
.
checkData
(
0
,
0
,
220
)
tdSql
.
checkData
(
0
,
0
,
220
)
tdSql
.
query
(
"select count(*) from stb3"
)
tdSql
.
query
(
"select count(*) from stb3"
)
tdSql
.
checkData
(
0
,
0
,
180
)
tdSql
.
checkData
(
0
,
0
,
180
)
tdSql
.
query
(
"select count(*) from stb4"
)
tdSql
.
query
(
"select count(*) from stb4"
)
tdSql
.
checkData
(
0
,
0
,
160
)
tdSql
.
checkData
(
0
,
0
,
160
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-newtable.json -y"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-newtable.json -y"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
150
)
tdSql
.
checkData
(
0
,
0
,
150
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
360
)
tdSql
.
checkData
(
0
,
0
,
360
)
tdSql
.
query
(
"select count(*) from stb2"
)
tdSql
.
query
(
"select count(*) from stb2"
)
tdSql
.
checkData
(
0
,
0
,
360
)
tdSql
.
checkData
(
0
,
0
,
360
)
tdSql
.
query
(
"select count(*) from stb3"
)
tdSql
.
query
(
"select count(*) from stb3"
)
tdSql
.
checkData
(
0
,
0
,
340
)
tdSql
.
checkData
(
0
,
0
,
340
)
tdSql
.
query
(
"select count(*) from stb4"
)
tdSql
.
query
(
"select count(*) from stb4"
)
tdSql
.
checkData
(
0
,
0
,
400
)
tdSql
.
checkData
(
0
,
0
,
400
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-renewdb.json -y"
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-renewdb.json -y"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
50
)
tdSql
.
checkData
(
0
,
0
,
50
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
120
)
tdSql
.
checkData
(
0
,
0
,
120
)
tdSql
.
query
(
"select count(*) from stb2"
)
tdSql
.
query
(
"select count(*) from stb2"
)
tdSql
.
checkData
(
0
,
0
,
140
)
tdSql
.
checkData
(
0
,
0
,
140
)
tdSql
.
query
(
"select count(*) from stb3"
)
tdSql
.
query
(
"select count(*) from stb3"
)
tdSql
.
checkData
(
0
,
0
,
160
)
tdSql
.
checkData
(
0
,
0
,
160
)
tdSql
.
query
(
"select count(*) from stb4"
)
tdSql
.
query
(
"select count(*) from stb4"
)
...
@@ -170,59 +170,59 @@ class TDTestCase:
...
@@ -170,59 +170,59 @@ class TDTestCase:
# insert: let parament in json file is illegal, it'll expect error.
# insert: let parament in json file is illegal, it'll expect error.
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertColumnsAndTagNumLarge1024.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertColumnsAndTagNumLarge1024.json -y "
%
binPath
)
tdSql
.
error
(
"use db"
)
tdSql
.
error
(
"use db"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertSigcolumnsNum1024.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertSigcolumnsNum1024.json -y "
%
binPath
)
tdSql
.
error
(
"select * from db.stb0"
)
tdSql
.
error
(
"select * from db.stb0"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertColumnsAndTagNum1024.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertColumnsAndTagNum1024.json -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertColumnsNum0.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertColumnsNum0.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables like 'stb0%' "
)
tdSql
.
query
(
"show stables like 'stb0%' "
)
tdSql
.
checkData
(
0
,
2
,
11
)
tdSql
.
checkData
(
0
,
2
,
11
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertTagsNumLarge128.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertTagsNumLarge128.json -y "
%
binPath
)
tdSql
.
error
(
"use db1"
)
tdSql
.
error
(
"use db1"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar16384.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar16384.json -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select count(*) from db.stb1"
)
tdSql
.
query
(
"select count(*) from db.stb1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
error
(
"select * from db.stb3"
)
tdSql
.
error
(
"select * from db.stb3"
)
tdSql
.
error
(
"select * from db.stb2"
)
tdSql
.
error
(
"select * from db.stb2"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertNumOfrecordPerReq0.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertNumOfrecordPerReq0.json -y "
%
binPath
)
tdSql
.
error
(
"select count(*) from db.stb0"
)
tdSql
.
error
(
"select count(*) from db.stb0"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertNumOfrecordPerReqless0.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertNumOfrecordPerReqless0.json -y "
%
binPath
)
tdSql
.
error
(
"use db"
)
tdSql
.
error
(
"use db"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertChildTab0.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertChildTab0.json -y "
%
binPath
)
tdSql
.
error
(
"use db"
)
tdSql
.
error
(
"use db"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertChildTabLess0.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertChildTabLess0.json -y "
%
binPath
)
tdSql
.
error
(
"use db"
)
tdSql
.
error
(
"use db"
)
tdSql
.
execute
(
"drop database if exists blf"
)
tdSql
.
execute
(
"drop database if exists blf"
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertTimestepMulRowsLargeint16.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertTimestepMulRowsLargeint16.json -y "
%
binPath
)
tdSql
.
execute
(
"use blf"
)
tdSql
.
execute
(
"use blf"
)
tdSql
.
query
(
"select ts from blf.p_0_topics_7 limit 262800,1"
)
tdSql
.
query
(
"select ts from blf.p_0_topics_7 limit 262800,1"
)
tdSql
.
checkData
(
0
,
0
,
"2020-03-31 12:00:00.000"
)
tdSql
.
checkData
(
0
,
0
,
"2020-03-31 12:00:00.000"
)
tdSql
.
query
(
"select first(ts) from blf.p_0_topics_2"
)
tdSql
.
query
(
"select first(ts) from blf.p_0_topics_2"
)
tdSql
.
checkData
(
0
,
0
,
"2019-10-01 00:00:00"
)
tdSql
.
checkData
(
0
,
0
,
"2019-10-01 00:00:00"
)
tdSql
.
query
(
"select last(ts) from blf.p_0_topics_6 "
)
tdSql
.
query
(
"select last(ts) from blf.p_0_topics_6 "
)
tdSql
.
checkData
(
0
,
0
,
"2020-09-29 23:59:00"
)
tdSql
.
checkData
(
0
,
0
,
"2020-09-29 23:59:00"
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertMaxNumPerReq.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insertMaxNumPerReq.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
5000000
)
tdSql
.
checkData
(
0
,
0
,
5000000
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
query
(
"select count(*) from stb1"
)
...
@@ -230,7 +230,7 @@ class TDTestCase:
...
@@ -230,7 +230,7 @@ class TDTestCase:
# insert: timestamp and step
# insert: timestamp and step
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-timestep.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-timestep.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
...
@@ -239,13 +239,13 @@ class TDTestCase:
...
@@ -239,13 +239,13 @@ class TDTestCase:
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
20
)
tdSql
.
checkData
(
0
,
0
,
20
)
tdSql
.
query
(
"select last(ts) from db.stb00_0"
)
tdSql
.
query
(
"select last(ts) from db.stb00_0"
)
tdSql
.
checkData
(
0
,
0
,
"2020-10-01 00:00:00.019000"
)
tdSql
.
checkData
(
0
,
0
,
"2020-10-01 00:00:00.019000"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
200
)
tdSql
.
checkData
(
0
,
0
,
200
)
tdSql
.
query
(
"select last(ts) from db.stb01_0"
)
tdSql
.
query
(
"select last(ts) from db.stb01_0"
)
tdSql
.
checkData
(
0
,
0
,
"2020-11-01 00:00:00.190000"
)
tdSql
.
checkData
(
0
,
0
,
"2020-11-01 00:00:00.190000"
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
400
)
tdSql
.
checkData
(
0
,
0
,
400
)
# # insert: disorder_ratio
# # insert: disorder_ratio
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-disorder.json -g 2>&1 -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-disorder.json -g 2>&1 -y "
%
binPath
)
...
@@ -255,14 +255,14 @@ class TDTestCase:
...
@@ -255,14 +255,14 @@ class TDTestCase:
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
checkData
(
0
,
0
,
10
)
# insert: sample json
# insert: sample json
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-sample.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-sample.json -y "
%
binPath
)
tdSql
.
execute
(
"use dbtest123"
)
tdSql
.
execute
(
"use dbtest123"
)
tdSql
.
query
(
"select c
ol
2 from stb0"
)
tdSql
.
query
(
"select c2 from stb0"
)
tdSql
.
checkData
(
0
,
0
,
2147483647
)
tdSql
.
checkData
(
0
,
0
,
2147483647
)
tdSql
.
query
(
"select * from stb1 where t1=-127"
)
tdSql
.
query
(
"select * from stb1 where t1=-127"
)
tdSql
.
checkRows
(
20
)
tdSql
.
checkRows
(
20
)
...
@@ -271,13 +271,13 @@ class TDTestCase:
...
@@ -271,13 +271,13 @@ class TDTestCase:
tdSql
.
query
(
"select * from stb1 where t2=126"
)
tdSql
.
query
(
"select * from stb1 where t2=126"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# insert: test interlace parament
# insert: test interlace parament
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-interlace-row.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/insert-interlace-row.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"select count (*) from stb0"
)
tdSql
.
query
(
"select count (*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
15000
)
tdSql
.
checkData
(
0
,
0
,
15000
)
# # insert: auto_create
# # insert: auto_create
...
@@ -317,10 +317,10 @@ class TDTestCase:
...
@@ -317,10 +317,10 @@ class TDTestCase:
tdSql
.
checkRows
(
20
)
tdSql
.
checkRows
(
20
)
os
.
system
(
"rm -rf ./insert_res.txt"
)
os
.
system
(
"rm -rf ./insert_res.txt"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/taosdemoTestInsertWithJson.py.sql"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/taosdemoTestInsertWithJson.py.sql"
)
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/tools/taosdemoTest.py
浏览文件 @
dedbb754
...
@@ -59,11 +59,11 @@ class TDTestCase:
...
@@ -59,11 +59,11 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
self
.
numberOfTables
*
self
.
numberOfRecords
)
tdSql
.
checkData
(
0
,
0
,
self
.
numberOfTables
*
self
.
numberOfRecords
)
tdSql
.
query
(
tdSql
.
query
(
"select sum(c
ol
1) from test.meters interval(1h) sliding(30m)"
)
"select sum(c1) from test.meters interval(1h) sliding(30m)"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
tdSql
.
query
(
"select apercentile(c
ol
1, 1) from test.meters interval(100s)"
)
"select apercentile(c1, 1) from test.meters interval(100s)"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
error
(
"select loc, count(loc) from test.meters"
)
tdSql
.
error
(
"select loc, count(loc) from test.meters"
)
...
...
tests/pytest/wal/sdbComp.py
浏览文件 @
dedbb754
...
@@ -26,11 +26,11 @@ class TDTestCase:
...
@@ -26,11 +26,11 @@ class TDTestCase:
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
getBuildPath
(
self
):
def
getBuildPath
(
self
):
global
selfPath
global
selfPath
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
else
:
...
@@ -43,7 +43,7 @@ class TDTestCase:
...
@@ -43,7 +43,7 @@ class TDTestCase:
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
break
return
buildPath
return
buildPath
def
run
(
self
):
def
run
(
self
):
# set path para
# set path para
...
@@ -62,9 +62,9 @@ class TDTestCase:
...
@@ -62,9 +62,9 @@ class TDTestCase:
os
.
system
(
"rm -rf %s/sim/dnode1/data/mnode_bak/"
%
testPath
)
os
.
system
(
"rm -rf %s/sim/dnode1/data/mnode_bak/"
%
testPath
)
tdSql
.
execute
(
"drop database if exists db2"
)
tdSql
.
execute
(
"drop database if exists db2"
)
os
.
system
(
"%staosdemo -f wal/insertDataDb1.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f wal/insertDataDb1.json -y "
%
binPath
)
tdSql
.
execute
(
"drop database if exists db1"
)
tdSql
.
execute
(
"drop database if exists db1"
)
os
.
system
(
"%staosdemo -f wal/insertDataDb2.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f wal/insertDataDb2.json -y "
%
binPath
)
tdSql
.
execute
(
"drop table if exists db2.stb0"
)
tdSql
.
execute
(
"drop table if exists db2.stb0"
)
os
.
system
(
"%staosdemo -f wal/insertDataDb2Newstab.json -y "
%
binPath
)
os
.
system
(
"%staosdemo -f wal/insertDataDb2Newstab.json -y "
%
binPath
)
query_pid1
=
int
(
subprocess
.
getstatusoutput
(
'ps aux|grep taosd |grep -v "grep"|awk
\'
{print $2}
\'
'
)[
1
])
query_pid1
=
int
(
subprocess
.
getstatusoutput
(
'ps aux|grep taosd |grep -v "grep"|awk
\'
{print $2}
\'
'
)[
1
])
print
(
query_pid1
)
print
(
query_pid1
)
...
@@ -72,14 +72,14 @@ class TDTestCase:
...
@@ -72,14 +72,14 @@ class TDTestCase:
tdSql
.
execute
(
"drop table if exists stb1_0"
)
tdSql
.
execute
(
"drop table if exists stb1_0"
)
tdSql
.
execute
(
"drop table if exists stb1_1"
)
tdSql
.
execute
(
"drop table if exists stb1_1"
)
tdSql
.
execute
(
"insert into stb0_0 values(1614218412000,8637,78.861045,'R','bf3')(1614218422000,8637,98.861045,'R','bf3')"
)
tdSql
.
execute
(
"insert into stb0_0 values(1614218412000,8637,78.861045,'R','bf3')(1614218422000,8637,98.861045,'R','bf3')"
)
tdSql
.
execute
(
"alter table db2.stb0 add column c
ol
4 int"
)
tdSql
.
execute
(
"alter table db2.stb0 add column c4 int"
)
tdSql
.
execute
(
"alter table db2.stb0 drop column c
ol
2"
)
tdSql
.
execute
(
"alter table db2.stb0 drop column c2"
)
tdSql
.
execute
(
"alter table db2.stb0 add tag t3 int;"
)
tdSql
.
execute
(
"alter table db2.stb0 add tag t3 int;"
)
tdSql
.
execute
(
"alter table db2.stb0 drop tag t1"
)
tdSql
.
execute
(
"alter table db2.stb0 drop tag t1"
)
tdSql
.
execute
(
"create table if not exists stb2_0 (ts timestamp, c
ol0 int, col
1 float) "
)
tdSql
.
execute
(
"create table if not exists stb2_0 (ts timestamp, c
0 int, c
1 float) "
)
tdSql
.
execute
(
"insert into stb2_0 values(1614218412000,8637,78.861045)"
)
tdSql
.
execute
(
"insert into stb2_0 values(1614218412000,8637,78.861045)"
)
tdSql
.
execute
(
"alter table stb2_0 add column c
ol
2 binary(4)"
)
tdSql
.
execute
(
"alter table stb2_0 add column c2 binary(4)"
)
tdSql
.
execute
(
"alter table stb2_0 drop column c
ol
1"
)
tdSql
.
execute
(
"alter table stb2_0 drop column c1"
)
tdSql
.
execute
(
"insert into stb2_0 values(1614218422000,8638,'R')"
)
tdSql
.
execute
(
"insert into stb2_0 values(1614218422000,8638,'R')"
)
# stop taosd and compact wal file
# stop taosd and compact wal file
...
@@ -87,9 +87,9 @@ class TDTestCase:
...
@@ -87,9 +87,9 @@ class TDTestCase:
sleep
(
10
)
sleep
(
10
)
os
.
system
(
"nohup %s/taosd --compact-mnode-wal -c %s/sim/dnode1/cfg/ & "
%
(
binPath
,
testPath
)
)
os
.
system
(
"nohup %s/taosd --compact-mnode-wal -c %s/sim/dnode1/cfg/ & "
%
(
binPath
,
testPath
)
)
sleep
(
5
)
sleep
(
5
)
assert
os
.
path
.
exists
(
walFilePath
)
,
"%s is not generated, compact didn't take effect "
%
walFilePath
assert
os
.
path
.
exists
(
walFilePath
)
,
"%s is not generated, compact didn't take effect "
%
walFilePath
# use new wal file to start taosd
# use new wal file to start taosd
tdDnodes
.
start
(
1
)
tdDnodes
.
start
(
1
)
sleep
(
5
)
sleep
(
5
)
tdSql
.
execute
(
"reset query cache"
)
tdSql
.
execute
(
"reset query cache"
)
...
@@ -108,14 +108,14 @@ class TDTestCase:
...
@@ -108,14 +108,14 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
query
(
"select count(*) from stb2_0"
)
tdSql
.
query
(
"select count(*) from stb2_0"
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
checkData
(
0
,
0
,
2
)
# delete useless file
# delete useless file
testcaseFilename
=
os
.
path
.
split
(
__file__
)[
-
1
]
testcaseFilename
=
os
.
path
.
split
(
__file__
)[
-
1
]
os
.
system
(
"rm -rf ./insert_res.txt"
)
os
.
system
(
"rm -rf ./insert_res.txt"
)
os
.
system
(
"rm -rf wal/%s.sql"
%
testcaseFilename
)
os
.
system
(
"rm -rf wal/%s.sql"
%
testcaseFilename
)
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录