Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5917291d
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1191
Star
22018
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看板
未验证
提交
5917291d
编写于
3月 28, 2022
作者:
sangshuduo
提交者:
GitHub
3月 28, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-14331]<fix>: cleanup taosdemo test cases (#11054)
* [TD-14331]<fix>: cleanup taosdemo test cases * fix taosTools-related cases
上级
e0aaab3a
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
461 addition
and
2296 deletion
+461
-2296
tests/pytest/tools/taosdemoAllTest/TD-10539/create_taosdemo.py
.../pytest/tools/taosdemoAllTest/TD-10539/create_taosdemo.py
+0
-185
tests/pytest/tools/taosdemoAllTest/TD-10539/create_taosdemo_no.json
...st/tools/taosdemoAllTest/TD-10539/create_taosdemo_no.json
+0
-63
tests/pytest/tools/taosdemoAllTest/TD-10539/create_taosdemo_yes.json
...t/tools/taosdemoAllTest/TD-10539/create_taosdemo_yes.json
+0
-63
tests/pytest/tools/taosdemoAllTest/TD-4985/query-limit-offset.py
...ytest/tools/taosdemoAllTest/TD-4985/query-limit-offset.py
+82
-51
tests/pytest/tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.py
.../tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.py
+26
-25
tests/pytest/tools/taosdemoAllTest/query-interrupt.py
tests/pytest/tools/taosdemoAllTest/query-interrupt.py
+0
-88
tests/pytest/tools/taosdemoAllTest/subscribeNoResult.py
tests/pytest/tools/taosdemoAllTest/subscribeNoResult.py
+0
-82
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py
...pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py
+47
-39
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py
...s/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py
+64
-51
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
...ytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
+0
-390
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py
...st/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py
+0
-266
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py
...t/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py
+0
-339
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmtPerformance.py
...sdemoAllTest/taosdemoTestInsertWithJsonStmtPerformance.py
+0
-92
tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py
...pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py
+0
-244
tests/pytest/tools/taosdemoAllTest/taosdemoTestSubWithJsonAsync.py
...est/tools/taosdemoAllTest/taosdemoTestSubWithJsonAsync.py
+0
-124
tests/pytest/tools/taosdemoTestInterlace.py
tests/pytest/tools/taosdemoTestInterlace.py
+10
-11
tests/pytest/tools/taosdemoTestLimitOffset.py
tests/pytest/tools/taosdemoTestLimitOffset.py
+22
-14
tests/pytest/tools/taosdemoTestSampleData.py
tests/pytest/tools/taosdemoTestSampleData.py
+10
-10
tests/pytest/tools/taosdemoTestTblAlt.py
tests/pytest/tools/taosdemoTestTblAlt.py
+12
-13
tests/pytest/tools/taosdemoTestWithoutMetric.py
tests/pytest/tools/taosdemoTestWithoutMetric.py
+12
-12
tests/pytest/tools/taosdemoTestdatatype.py
tests/pytest/tools/taosdemoTestdatatype.py
+27
-24
tests/pytest/tools/taosdumpTest2.py
tests/pytest/tools/taosdumpTest2.py
+22
-17
tests/pytest/tools/taosdumpTest3.py
tests/pytest/tools/taosdumpTest3.py
+127
-93
未找到文件。
tests/pytest/tools/taosdemoAllTest/TD-10539/create_taosdemo.py
已删除
100644 → 0
浏览文件 @
e0aaab3a
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
taos
import
time
import
os
from
util.log
import
tdLog
from
util.cases
import
tdCases
from
util.sql
import
tdSql
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
def
run
(
self
):
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
os
.
system
(
"rm -rf tools/taosdemoAllTest/TD-10539/create_taosdemo.py.sql"
)
tdSql
.
prepare
()
#print("==============taosdemo,#create stable,table; insert table; show table; select table; drop table")
self
.
tsdemo
=
"tsdemo~!.@#$%^*[]-_=+{,?.}"
#this escape character is not support in shell . include & () <> | /
os
.
system
(
"%staosBenchmark -d test -E -m %s -t 10 -n 100 -l 10 -y "
%
(
binPath
,
self
.
tsdemo
))
tdSql
.
execute
(
"use test ;"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
tdSql
.
query
(
"show test.tables like 'tsdemo%'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"show test.tables like '%s_'"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select _block_dist() from `%s1`"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"describe test.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
checkRows
(
13
)
tdSql
.
query
(
"show create table test.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
checkData
(
0
,
0
,
self
.
tsdemo
+
str
(
1
))
tdSql
.
checkData
(
0
,
1
,
"CREATE TABLE `%s1` USING `meters` TAGS (1,
\"
beijing
\"
)"
%
self
.
tsdemo
)
print
(
"==============drop table\stable"
)
try
:
tdSql
.
execute
(
"drop table test.`%s1` ; "
%
self
.
tsdemo
)
except
Exception
as
e
:
tdLog
.
exit
(
e
)
tdSql
.
error
(
"select * from test.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
query
(
"show test.tables like '%s_'"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
9
)
try
:
tdSql
.
execute
(
"drop table test.meters "
)
except
Exception
as
e
:
tdLog
.
exit
(
e
)
tdSql
.
error
(
"select * from test.meters "
)
tdSql
.
error
(
"select * from test.`%s2` ; "
%
self
.
tsdemo
)
# Exception
os
.
system
(
"%staosBenchmark -d test -m %s -t 10 -n 100 -l 10 -y "
%
(
binPath
,
self
.
tsdemo
))
tdSql
.
query
(
"show test.tables "
)
tdSql
.
checkRows
(
0
)
#print("==============taosdemo,#create regular table; insert table; show table; select table; drop table")
self
.
tsdemo
=
"tsdemo~!.@#$%^*[]-_=+{,?.}"
#this escape character is not support in shell . include & () <> | /
os
.
system
(
"%staosBenchmark -N -E -m %s -t 10 -n 100 -l 10 -y "
%
(
binPath
,
self
.
tsdemo
))
tdSql
.
execute
(
"use test ;"
)
tdSql
.
query
(
"select count(*) from `%s1`"
%
self
.
tsdemo
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"show test.tables like 'tsdemo%'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"show test.tables like '%s_'"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select _block_dist() from `%s1`"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"describe test.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
checkRows
(
11
)
tdSql
.
query
(
"show create table test.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
checkData
(
0
,
0
,
self
.
tsdemo
+
str
(
1
))
tdSql
.
checkData
(
0
,
1
,
"CREATE TABLE `%s1` (ts TIMESTAMP,c0 FLOAT,c1 INT,c2 FLOAT,c3 INT,c4 INT,c5 INT,c6 INT,c7 INT,c8 INT,c9 INT)"
%
self
.
tsdemo
)
print
(
"==============drop table\stable"
)
try
:
tdSql
.
execute
(
"drop table test.`%s1` ; "
%
self
.
tsdemo
)
except
Exception
as
e
:
tdLog
.
exit
(
e
)
tdSql
.
error
(
"select * from test.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
query
(
"show test.tables like '%s_'"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
9
)
# Exception
os
.
system
(
"%staosBenchmark -N -m %s -t 10 -n 100 -l 10 -y "
%
(
binPath
,
self
.
tsdemo
))
tdSql
.
query
(
"show test.tables "
)
tdSql
.
checkRows
(
0
)
#print("==============taosdemo——json_yes,#create stable,table; insert table; show table; select table; drop table")
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/TD-10539/create_taosdemo_yes.json -y "
%
binPath
)
tdSql
.
execute
(
"use dbyes"
)
self
.
tsdemo_stable
=
"tsdemo_stable~!.@#$%^*[]-_=+{,?.}"
self
.
tsdemo
=
"tsdemo~!.@#$%^*[]-_=+{,?.}"
tdSql
.
query
(
"select count(*) from dbyes.`%s`"
%
self
.
tsdemo_stable
)
tdSql
.
checkData
(
0
,
0
,
1000
)
tdSql
.
query
(
"show dbyes.tables like 'tsdemo%'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"show dbyes.tables like '%s_'"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select _block_dist() from `%s1`"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"describe dbyes.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
checkRows
(
13
)
tdSql
.
query
(
"show create table dbyes.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
checkData
(
0
,
0
,
self
.
tsdemo
+
str
(
1
))
tdSql
.
checkData
(
0
,
1
,
"CREATE TABLE `%s1` USING `%s` TAGS (1,1)"
%
(
self
.
tsdemo
,
self
.
tsdemo_stable
))
print
(
"==============drop table\stable"
)
try
:
tdSql
.
execute
(
"drop table dbyes.`%s1` ; "
%
self
.
tsdemo
)
except
Exception
as
e
:
tdLog
.
exit
(
e
)
tdSql
.
error
(
"select * from dbyes.`%s1` ; "
%
self
.
tsdemo
)
tdSql
.
query
(
"show dbyes.tables like '%s_'"
%
self
.
tsdemo
)
tdSql
.
checkRows
(
9
)
try
:
tdSql
.
execute
(
"drop table dbyes.`%s` ; "
%
self
.
tsdemo_stable
)
except
Exception
as
e
:
tdLog
.
exit
(
e
)
tdSql
.
error
(
"select * from dbyes.`%s` ; "
%
self
.
tsdemo_stable
)
tdSql
.
error
(
"select * from dbyes.`%s2` ; "
%
self
.
tsdemo
)
#print("==============taosdemo——json_no,#create stable,table; insert table; show table; select table; drop table")
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/TD-10539/create_taosdemo_no.json -y "
%
binPath
)
tdSql
.
query
(
"show dbno.tables;"
)
tdSql
.
checkRows
(
0
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/tools/taosdemoAllTest/TD-10539/create_taosdemo_no.json
已删除
100644 → 0
浏览文件 @
e0aaab3a
{
"filetype"
:
"insert"
,
"cfgdir"
:
"/etc/taos"
,
"host"
:
"127.0.0.1"
,
"port"
:
6030
,
"user"
:
"root"
,
"password"
:
"taosdata"
,
"thread_count"
:
10
,
"thread_count_create_tbl"
:
10
,
"result_file"
:
"./insert_res.txt"
,
"confirm_parameter_prompt"
:
"no"
,
"insert_interval"
:
0
,
"interlace_rows"
:
10
,
"num_of_records_per_req"
:
1
,
"max_sql_len"
:
1024000
,
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"dbno"
,
"drop"
:
"yes"
,
"replica"
:
1
,
"days"
:
10
,
"cache"
:
50
,
"blocks"
:
8
,
"precision"
:
"ms"
,
"keep"
:
36500
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
"walLevel"
:
1
,
"cachelast"
:
0
,
"quorum"
:
1
,
"fsync"
:
3000
,
"update"
:
0
},
"super_tables"
:
[{
"name"
:
"meters"
,
"child_table_exists"
:
"no"
,
"childtable_count"
:
10
,
"childtable_prefix"
:
"tsdemo~!.@#$%^*[]-_=+{,?.}"
,
"escape_character"
:
"no"
,
"auto_create_table"
:
"no"
,
"batch_create_tbl_num"
:
1
,
"data_source"
:
"rand"
,
"insert_mode"
:
"taosc"
,
"insert_rows"
:
100
,
"childtable_limit"
:
0
,
"childtable_offset"
:
0
,
"multi_thread_write_one_tbl"
:
"no"
,
"interlace_rows"
:
0
,
"insert_interval"
:
0
,
"max_sql_len"
:
1024000
,
"disorder_ratio"
:
0
,
"disorder_range"
:
1000
,
"timestamp_step"
:
1
,
"start_timestamp"
:
"2020-10-01 00:00:00.000"
,
"sample_format"
:
"csv"
,
"sample_file"
:
""
,
"tags_file"
:
""
,
"columns"
:
[{
"type"
:
"INT"
,
"count"
:
9
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
1
}],
"tags"
:
[{
"type"
:
"INT"
,
"count"
:
2
}]
}]
}]
}
tests/pytest/tools/taosdemoAllTest/TD-10539/create_taosdemo_yes.json
已删除
100644 → 0
浏览文件 @
e0aaab3a
{
"filetype"
:
"insert"
,
"cfgdir"
:
"/etc/taos"
,
"host"
:
"127.0.0.1"
,
"port"
:
6030
,
"user"
:
"root"
,
"password"
:
"taosdata"
,
"thread_count"
:
5
,
"thread_count_create_tbl"
:
10
,
"result_file"
:
"./insert_res.txt"
,
"confirm_parameter_prompt"
:
"no"
,
"insert_interval"
:
0
,
"interlace_rows"
:
10
,
"num_of_records_per_req"
:
1
,
"max_sql_len"
:
1024000
,
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"dbyes"
,
"drop"
:
"yes"
,
"replica"
:
1
,
"days"
:
10
,
"cache"
:
50
,
"blocks"
:
8
,
"precision"
:
"ms"
,
"keep"
:
36500
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
"walLevel"
:
1
,
"cachelast"
:
0
,
"quorum"
:
1
,
"fsync"
:
3000
,
"update"
:
0
},
"super_tables"
:
[{
"name"
:
"tsdemo_stable~!.@#$%^*[]-_=+{,?.}"
,
"child_table_exists"
:
"no"
,
"childtable_count"
:
10
,
"childtable_prefix"
:
"tsdemo~!.@#$%^*[]-_=+{,?.}"
,
"escape_character"
:
"yes"
,
"auto_create_table"
:
"no"
,
"batch_create_tbl_num"
:
1
,
"data_source"
:
"rand"
,
"insert_mode"
:
"taosc"
,
"insert_rows"
:
100
,
"childtable_limit"
:
0
,
"childtable_offset"
:
0
,
"multi_thread_write_one_tbl"
:
"no"
,
"interlace_rows"
:
0
,
"insert_interval"
:
0
,
"max_sql_len"
:
1024000
,
"disorder_ratio"
:
0
,
"disorder_range"
:
1000
,
"timestamp_step"
:
1
,
"start_timestamp"
:
"2020-10-01 00:00:00.000"
,
"sample_format"
:
"csv"
,
"sample_file"
:
""
,
"tags_file"
:
""
,
"columns"
:
[{
"type"
:
"INT"
,
"count"
:
9
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
1
}],
"tags"
:
[{
"type"
:
"INT"
,
"count"
:
2
}]
}]
}]
}
tests/pytest/tools/taosdemoAllTest/TD-4985/query-limit-offset.py
浏览文件 @
5917291d
...
...
@@ -28,7 +28,7 @@ class TDTestCase:
now
=
time
.
time
()
self
.
ts
=
int
(
round
(
now
*
1000
))
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosBenchmark"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -36,153 +36,184 @@ class TDTestCase:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
run
(
self
):
b
uildPath
=
self
.
getBuildPath
(
)
if
(
b
uild
Path
==
""
):
tdLog
.
exit
(
"taos
d
not found!"
)
b
inPath
=
self
.
getPath
(
"taosBenchmark"
)
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taos
Benchmark
not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
tdLog
.
info
(
"taosBenchmark found in %s"
%
binPath
)
# 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
os
.
system
(
"rm -rf tools/taosdemoAllTest/TD-4985/query-limit-offset.py.sql"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/TD-4985/query-limit-offset.json -y "
%
binPath
)
os
.
system
(
"%s -f tools/taosdemoAllTest/TD-4985/query-limit-offset.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10000
)
for
i
in
range
(
1000
):
tdSql
.
execute
(
'''insert into stb00_9999 values(%d, %d, %d,'test99.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_8888 values(%d, %d, %d,'test98.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_7777 values(%d, %d, %d,'test97.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_6666 values(%d, %d, %d,'test96.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_5555 values(%d, %d, %d,'test95.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_4444 values(%d, %d, %d,'test94.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_3333 values(%d, %d, %d,'test93.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_2222 values(%d, %d, %d,'test92.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_1111 values(%d, %d, %d,'test91.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_100 values(%d, %d, %d,'test90.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_9999 values(%d, %d, %d,'test99.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_8888 values(%d, %d, %d,'test98.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_7777 values(%d, %d, %d,'test97.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_6666 values(%d, %d, %d,'test96.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_5555 values(%d, %d, %d,'test95.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_4444 values(%d, %d, %d,'test94.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_3333 values(%d, %d, %d,'test93.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_2222 values(%d, %d, %d,'test92.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_1111 values(%d, %d, %d,'test91.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
execute
(
'''insert into stb00_100 values(%d, %d, %d,'test90.%s')'''
%
(
self
.
ts
+
i
,
i
,
-
10000
+
i
,
i
))
tdSql
.
query
(
"select * from stb0 where c2 like 'test99%' "
)
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
(
1
,
1
,
1
)
tdSql
.
checkData
(
2
,
1
,
2
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_9999' limit 10 offset 5"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_9999' limit 10 offset 5"
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test98%' "
)
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
(
1
,
1
,
1
)
tdSql
.
checkData
(
2
,
1
,
2
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_8888' limit 10 offset 5"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_8888' limit 10 offset 5"
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test97%' "
)
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
(
1
,
1
,
1
)
tdSql
.
checkData
(
2
,
1
,
2
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_7777' limit 10 offset 5"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_7777' limit 10 offset 5"
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test96%' "
)
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
(
1
,
1
,
1
)
tdSql
.
checkData
(
2
,
1
,
2
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_6666' limit 10 offset 5"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_6666' limit 10 offset 5"
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test95%' "
)
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
(
1
,
1
,
1
)
tdSql
.
checkData
(
2
,
1
,
2
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_5555' limit 10 offset 5"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_5555' limit 10 offset 5"
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test94%' "
)
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
(
1
,
1
,
1
)
tdSql
.
checkData
(
2
,
1
,
2
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_4444' limit 10 offset 5"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_4444' limit 10 offset 5"
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test93%' "
)
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
(
1
,
1
,
1
)
tdSql
.
checkData
(
2
,
1
,
2
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_3333' limit 100 offset 5"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_3333' limit 100 offset 5"
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test92%' "
)
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
(
1
,
1
,
1
)
tdSql
.
checkData
(
2
,
1
,
2
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_2222' limit 100 offset 5"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_2222' limit 100 offset 5"
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test91%' "
)
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
(
1
,
1
,
1
)
tdSql
.
checkData
(
2
,
1
,
2
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_1111' limit 100 offset 5"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_1111' limit 100 offset 5"
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
tdSql
.
query
(
"select * from stb0 where c2 like 'test90%' "
)
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
(
1
,
1
,
1
)
tdSql
.
checkData
(
2
,
1
,
2
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_100' limit 100 offset 5"
)
tdSql
.
query
(
"select * from stb0 where tbname like 'stb00_100' limit 100 offset 5"
)
tdSql
.
checkData
(
0
,
1
,
5
)
tdSql
.
checkData
(
1
,
1
,
6
)
tdSql
.
checkData
(
2
,
1
,
7
)
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/pytest/tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.py
浏览文件 @
5917291d
...
...
@@ -24,8 +24,8 @@ class TDTestCase:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosBenchmark"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -33,26 +33,26 @@ class TDTestCase:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
run
(
self
):
b
uildPath
=
self
.
getBuildPath
(
)
if
(
b
uild
Path
==
""
):
tdLog
.
exit
(
"taos
d
not found!"
)
b
inPath
=
self
.
getPath
(
"taosBenchmark"
)
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taos
Benchmark
not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
tdLog
.
info
(
"taosBenchmark found in %s"
%
binPath
)
#-N:regular table -d:database name -t:table num -n:rows num per table -l:col num -y:force
#regular old && new
#
regular old && new
startTime
=
time
.
time
()
os
.
system
(
"%s
taosBenchmark
-N -d regular_old -t 1 -n 10 -l 1023 -y"
%
binPath
)
os
.
system
(
"%s -N -d regular_old -t 1 -n 10 -l 1023 -y"
%
binPath
)
tdSql
.
execute
(
"use regular_old"
)
tdSql
.
query
(
"show tables;"
)
tdSql
.
checkRows
(
1
)
...
...
@@ -61,7 +61,7 @@ class TDTestCase:
tdSql
.
query
(
"describe d0;"
)
tdSql
.
checkRows
(
1024
)
os
.
system
(
"%s
taosBenchmark
-N -d regular_new -t 1 -n 10 -l 4095 -y"
%
binPath
)
os
.
system
(
"%s -N -d regular_new -t 1 -n 10 -l 4095 -y"
%
binPath
)
tdSql
.
execute
(
"use regular_new"
)
tdSql
.
query
(
"show tables;"
)
tdSql
.
checkRows
(
1
)
...
...
@@ -70,8 +70,9 @@ class TDTestCase:
tdSql
.
query
(
"describe d0;"
)
tdSql
.
checkRows
(
4096
)
#super table -d:database name -t:table num -n:rows num per table -l:col num -y:force
os
.
system
(
"%staosBenchmark -d super_old -t 1 -n 10 -l 1021 -y"
%
binPath
)
# super table -d:database name -t:table num -n:rows num per table
# -l:col num -y:force
os
.
system
(
"%s -d super_old -t 1 -n 10 -l 1021 -y"
%
binPath
)
tdSql
.
execute
(
"use super_old"
)
tdSql
.
query
(
"show tables;"
)
tdSql
.
checkRows
(
1
)
...
...
@@ -84,7 +85,7 @@ class TDTestCase:
tdSql
.
query
(
"describe d0;"
)
tdSql
.
checkRows
(
1024
)
os
.
system
(
"%s
taosBenchmark
-d super_new -t 1 -n 10 -l 4093 -y"
%
binPath
)
os
.
system
(
"%s -d super_new -t 1 -n 10 -l 4093 -y"
%
binPath
)
tdSql
.
execute
(
"use super_new"
)
tdSql
.
query
(
"show tables;"
)
tdSql
.
checkRows
(
1
)
...
...
@@ -102,9 +103,11 @@ class TDTestCase:
tdSql
.
query
(
"describe stb_new1_1;"
)
tdSql
.
checkRows
(
4096
)
# 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
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.json -y "
%
binPath
)
os
.
system
(
"%s -f tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.json -y "
%
binPath
)
tdSql
.
execute
(
"use json_test"
)
tdSql
.
query
(
"select count (tbname) from stb_old"
)
tdSql
.
checkData
(
0
,
0
,
1
)
...
...
@@ -112,7 +115,7 @@ class TDTestCase:
tdSql
.
query
(
"select * from stb_old"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkCols
(
1024
)
tdSql
.
query
(
"select count (tbname) from stb_new"
)
tdSql
.
checkData
(
0
,
0
,
1
)
...
...
@@ -160,13 +163,11 @@ class TDTestCase:
tdSql
.
query
(
"describe stb_excel_0;"
)
tdSql
.
checkRows
(
4096
)
endTime
=
time
.
time
()
print
(
"total time %ds"
%
(
endTime
-
startTime
))
print
(
"total time %ds"
%
(
endTime
-
startTime
))
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
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/tools/taosdemoAllTest/query-interrupt.py
已删除
100644 → 0
浏览文件 @
e0aaab3a
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
os
import
subprocess
import
time
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
def
run
(
self
):
tdSql
.
prepare
()
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
# # insert 1000w rows in stb0
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/query-interrupt.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
60
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
6000000
)
os
.
system
(
'%staosBenchmark -f tools/taosdemoAllTest/queryall.json -y & '
%
binPath
)
time
.
sleep
(
2
)
query_pid
=
int
(
subprocess
.
getstatusoutput
(
'ps aux|grep "taosdemoAllTest/queryall.json" |grep -v "grep"|awk
\'
{print $2}
\'
'
)[
1
])
taosd_cpu_load_1
=
float
(
subprocess
.
getstatusoutput
(
'top -n 1 -b -p $(ps aux|grep "bin/taosd -c"|grep -v "grep" |awk
\'
{print $2}
\'
)|awk
\'
END{print}
\'
|awk
\'
{print $9}
\'
'
)[
1
])
if
taosd_cpu_load_1
>
10.0
:
os
.
system
(
"kill -9 %d"
%
query_pid
)
time
.
sleep
(
5
)
taosd_cpu_load_2
=
float
(
subprocess
.
getstatusoutput
(
'top -n 1 -b -p $(ps aux|grep "bin/taosd -c"|grep -v "grep" |awk
\'
{print $2}
\'
)|awk
\'
END{print}
\'
|awk
\'
{print $9}
\'
'
)[
1
])
if
taosd_cpu_load_2
<
10.0
:
suc_kill
=
60
else
:
suc_kill
=
10
print
(
"taosd_cpu_load is higher than 10%"
)
else
:
suc_kill
=
20
print
(
"taosd_cpu_load is still less than 10%"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
"%d"
%
suc_kill
)
os
.
system
(
"rm -rf querySystemInfo*"
)
os
.
system
(
"rm -rf insert_res.txt"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/tools/taosdemoAllTest/subscribeNoResult.py
已删除
100644 → 0
浏览文件 @
e0aaab3a
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
os
import
time
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
import
_thread
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
ts
=
1601481600000
self
.
numberOfRecords
=
1100000
def
execCmdAndGetOutput
(
self
,
cmd
):
r
=
os
.
popen
(
cmd
)
text
=
r
.
read
()
r
.
close
()
return
text
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
def
run
(
self
):
buildPath
=
self
.
getBuildPath
()
tdSql
.
prepare
()
tdSql
.
execute
(
"create table st(ts timestamp, c1 timestamp, c2 int, c3 bigint, c4 float, c5 double, c6 binary(8), c7 smallint, c8 tinyint, c9 bool, c10 nchar(8)) tags(t1 int)"
)
tdSql
.
execute
(
"create table t1 using st tags(0)"
)
currts
=
self
.
ts
finish
=
0
while
(
finish
<
self
.
numberOfRecords
):
sql
=
"insert into t1 values"
for
i
in
range
(
finish
,
self
.
numberOfRecords
):
sql
+=
"(%d, 1019774612, 29931, 1442173978, 165092.468750, 1128.643179, 'MOCq1pTu', 18405, 82, 0, 'g0A6S0Fu')"
%
(
currts
+
i
)
finish
=
i
+
1
if
(
1048576
-
len
(
sql
))
<
16384
:
break
tdSql
.
execute
(
sql
)
binPath
=
buildPath
+
"/build/bin/"
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sub_no_result.json -g 2>&1 | tee sub_no_result.log"
%
binPath
)
test_line
=
int
(
self
.
execCmdAndGetOutput
(
"cat sub_no_result.log | wc -l"
))
if
(
test_line
<
1100024
):
tdLog
.
exit
(
"failed test subscribeNoResult: %d != expected(1100024)"
%
test_line
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertAllType.py
浏览文件 @
5917291d
...
...
@@ -24,7 +24,7 @@ class TDTestCase:
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosBenchmark"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -32,24 +32,26 @@ class TDTestCase:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
run
(
self
):
b
uildPath
=
self
.
getBuildPath
(
)
if
(
b
uild
Path
==
""
):
tdLog
.
exit
(
"taos
d
not found!"
)
b
inPath
=
self
.
getPath
(
"taosBenchmark"
)
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taos
Benchmark
not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
tdLog
.
info
(
"taosBenchmark found in %s"
%
binPath
)
# taosc interface
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insert-allDataType.json -y "
%
binPath
)
# taosc interface
os
.
system
(
"%s -f tools/taosdemoAllTest/insert-allDataType.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -64,8 +66,10 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
200000
)
# stmt interface
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-allDataType-stmt.json -y "
%
binPath
)
# stmt interface
os
.
system
(
"%s -f tools/taosdemoAllTest/stmt/insert-allDataType-stmt.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -80,53 +84,60 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
200000
)
# insert-interface: sml
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insert-allDataType-sml.json -y "
%
binPath
)
# insert-interface: sml
os
.
system
(
"%s -f tools/taosdemoAllTest/sml/insert-allDataType-sml.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
20
)
# 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
.
checkData
(
0
,
0
,
1000
)
tdSql
.
checkData
(
0
,
0
,
1000
)
# 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
.
checkData
(
0
,
0
,
4000
)
tdSql
.
checkData
(
0
,
0
,
4000
)
# insert-interface: sml-json
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sml-json-alltype.json -y "
%
binPath
)
# insert-interface: sml-json
os
.
system
(
"%s -f tools/taosdemoAllTest/sml/insert-sml-json-alltype.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
for
i
in
range
(
13
):
for
j
in
range
(
13
):
if
tdSql
.
queryResult
[
i
][
0
]
==
'stb%d'
%
j
:
for
j
in
range
(
13
):
if
tdSql
.
queryResult
[
i
][
0
]
==
'stb%d'
%
j
:
# print(i,"stb%d"%j)
tdSql
.
checkData
(
i
,
4
,
j
+
1
)
tdSql
.
checkData
(
i
,
4
,
j
+
1
)
# insert-interface: sml-telnet
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json -y "
%
binPath
)
os
.
system
(
"%s -f tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
for
i
in
range
(
13
):
for
j
in
range
(
13
):
if
tdSql
.
queryResult
[
i
][
0
]
==
'stb%d'
%
j
:
for
j
in
range
(
13
):
if
tdSql
.
queryResult
[
i
][
0
]
==
'stb%d'
%
j
:
# print(i,"stb%d"%j)
tdSql
.
checkData
(
i
,
4
,
j
+
1
)
tdSql
.
checkData
(
i
,
4
,
j
+
1
)
for
i
in
range
(
13
):
tdSql
.
query
(
"select count(*) from stb%d"
%
i
)
tdSql
.
checkData
(
0
,
0
,
(
i
+
1
)
*
10
)
tdSql
.
query
(
"select count(*) from stb%d"
%
i
)
tdSql
.
checkData
(
0
,
0
,
(
i
+
1
)
*
10
)
# insert-interface: sml-telnet
assert
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/sml/insert-sml-timestamp.json -y "
%
binPath
)
!=
0
assert
os
.
system
(
"%s -f tools/taosdemoAllTest/sml/insert-sml-timestamp.json -y "
%
binPath
)
!=
0
# taosdemo command line
os
.
system
(
"%staosBenchmark -t 1000 -n 100 -T 10 -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,NCHAR,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY -y "
%
binPath
)
os
.
system
(
"%s -t 1000 -n 100 -T 10 -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,NCHAR,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY -y "
%
binPath
)
tdSql
.
execute
(
"use test"
)
tdSql
.
query
(
"select count (tbname) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -137,10 +148,7 @@ class TDTestCase:
testcaseFilename
=
os
.
path
.
split
(
__file__
)[
-
1
]
os
.
system
(
"rm -rf ./insert_res.txt"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/%s.sql"
%
testcaseFilename
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/%s.sql"
%
testcaseFilename
)
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py
浏览文件 @
5917291d
...
...
@@ -24,40 +24,41 @@ class TDTestCase:
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosBenchmark"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
global
cfgPath
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
cfgPath
=
projPath
+
"/community/sim/dnode1/cfg"
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
cfgPath
=
projPath
+
"/sim/dnode1/cfg"
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
# def checkGerData():
def
run
(
self
):
b
uildPath
=
self
.
getBuildPath
(
)
print
(
"%s"
%
cfgPath
)
if
(
b
uild
Path
==
""
):
tdLog
.
exit
(
"taos
d
not found!"
)
b
inPath
=
self
.
getPath
(
"taosBenchmark"
)
print
(
"%s"
%
cfgPath
)
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taos
Benchmark
not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
tdLog
.
info
(
"taosBenchmark found in %s"
%
binPath
)
tdLog
.
info
(
"create super table"
)
# create super table
os
.
system
(
"%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
))
# create super table
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"describe meters;"
)
tdSql
.
checkRows
(
13
)
...
...
@@ -68,12 +69,13 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from `test.0`"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdLog
.
info
(
"create general table -N "
)
tdSql
.
execute
(
"drop database db1;"
)
# create general table -N
os
.
system
(
"%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -N "
%
(
binPath
,
cfgPath
))
# create general table -N
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -N "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"describe `test.0`;"
)
tdSql
.
checkRows
(
11
)
...
...
@@ -85,8 +87,10 @@ class TDTestCase:
tdLog
.
info
(
"use diffrent interface stmt"
)
tdSql
.
execute
(
"drop database db1;"
)
# use diffrent interface-stmt
os
.
system
(
"%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,BINARY\(4000\) -w 40
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt "
%
(
binPath
,
cfgPath
))
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,BINARY\(4000\) -w 40
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -98,8 +102,10 @@ class TDTestCase:
tdLog
.
info
(
"use diffrent interface rest"
)
tdSql
.
execute
(
"drop database db1;"
)
# use diffrent interface -rest
os
.
system
(
"%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4097
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest "
%
(
binPath
,
cfgPath
))
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4097
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -111,8 +117,10 @@ class TDTestCase:
tdLog
.
info
(
"use diffrent interface sml"
)
tdSql
.
execute
(
"drop database db1;"
)
# use diffrent interface-sml
os
.
system
(
"%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 1024
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I sml "
%
(
binPath
,
cfgPath
))
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 1024
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I sml "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -122,9 +130,9 @@ class TDTestCase:
tdLog
.
info
(
"all data type"
)
tdSql
.
execute
(
"drop database db1;"
)
# all data type-taosc
os
.
system
(
"%s
taosBenchmark
-u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10
\
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10
\
-b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
))
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -135,9 +143,9 @@ class TDTestCase:
tdLog
.
info
(
"all data type"
)
tdSql
.
execute
(
"drop database db1;"
)
# all data type-stmt
os
.
system
(
"%s
taosBenchmark
-u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10
\
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10
\
-b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt "
%
(
binPath
,
cfgPath
))
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -147,9 +155,9 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
100
)
# all data type-rest
os
.
system
(
"%s
taosBenchmark
-u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10
\
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10
\
-b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest "
%
(
binPath
,
cfgPath
))
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -159,7 +167,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
100
)
# # all data type-rest
# os.system("%s
taosBenchmark
-u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \
# os.system("%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \
# -b INT,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096 \
# -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I sml " % (binPath,cfgPath))
# tdSql.execute("use db1")
...
...
@@ -172,10 +180,10 @@ class TDTestCase:
tdLog
.
info
(
"all data type and interlace rows"
)
tdSql
.
execute
(
"drop database db1;"
)
# all data type
os
.
system
(
"%s
taosBenchmark
-u root -c %s -h localhost -P 6030 -d db3 -a 1 -l 10
\
# all data type
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db3 -a 1 -l 10
\
-b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -B 1000 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
))
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -B 1000 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
))
tdSql
.
execute
(
"use db3"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -185,14 +193,18 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
100
)
tdLog
.
info
(
"all data type and too much para"
)
tdLog
.
info
(
"%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096
\
tdLog
.
info
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test.taosdemo -u root -c %s -h
\
localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
,
cfgPath
))
localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
,
cfgPath
))
tdSql
.
execute
(
"drop database db3;"
)
# repeate parameters
os
.
system
(
"%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096
\
# repeate parameters
os
.
system
(
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096
\
-T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test.taosdemo -u root -c %s -h
\
localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
,
cfgPath
))
localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. "
%
(
binPath
,
cfgPath
,
cfgPath
))
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
...
...
@@ -203,21 +215,22 @@ class TDTestCase:
# taosdemo error
# too max length
sql
=
"%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(4096\)
\
-w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc"
%
(
binPath
,
cfgPath
)
tdLog
.
info
(
"%s"
%
sql
)
assert
os
.
system
(
"%s"
%
sql
)
!=
0
# error password
sql
=
"%staosBenchmark -u root -c %s -h localhost -P 6030 -p123 -d db1 -a 1 -l 10 -b float,int,NCHAR\(40\)
\
-w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt"
%
(
binPath
,
cfgPath
)
tdLog
.
info
(
"%s"
%
sql
)
assert
os
.
system
(
"%s"
%
sql
)
!=
0
sql
=
"%s -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(4096\)
\
-w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc"
%
(
binPath
,
cfgPath
)
tdLog
.
info
(
"%s"
%
sql
)
assert
os
.
system
(
"%s"
%
sql
)
!=
0
# error password
sql
=
"%s -u root -c %s -h localhost -P 6030 -p123 -d db1 -a 1 -l 10 -b float,int,NCHAR\(40\)
\
-w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt"
%
(
binPath
,
cfgPath
)
tdLog
.
info
(
"%s"
%
sql
)
assert
os
.
system
(
"%s"
%
sql
)
!=
0
testcaseFilename
=
os
.
path
.
split
(
__file__
)[
-
1
]
os
.
system
(
"rm -rf ./insert_res*.txt*"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/%s.sql"
%
testcaseFilename
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/%s.sql"
%
testcaseFilename
)
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
已删除
100644 → 0
浏览文件 @
e0aaab3a
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
os
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
def
run
(
self
):
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
testcaseFilename
=
os
.
path
.
split
(
__file__
)[
-
1
]
os
.
system
(
"rm -rf ./insert*_res.txt*"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/%s.sql"
%
testcaseFilename
)
# insert: create one or mutiple tables per sql and insert multiple rows per sql
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insert-1s1tnt1r.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
11
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count(*) from stb00_0"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
1100
)
tdSql
.
query
(
"select count(*) from stb01_1"
)
tdSql
.
checkData
(
0
,
0
,
200
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
2000
)
# restful connector insert data
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insertRestful.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count(*) from stb00_0"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"select count(*) from stb01_1"
)
tdSql
.
checkData
(
0
,
0
,
20
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
200
)
# default values json files
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insert-default.json -y "
%
binPath
)
tdSql
.
query
(
"show databases;"
)
for
i
in
range
(
tdSql
.
queryRows
):
if
tdSql
.
queryResult
[
i
][
0
]
==
'db'
:
tdSql
.
checkData
(
i
,
2
,
100
)
tdSql
.
checkData
(
i
,
4
,
1
)
tdSql
.
checkData
(
i
,
6
,
10
)
tdSql
.
checkData
(
i
,
16
,
'ms'
)
# insert: create mutiple tables per sql and insert one rows per sql .
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insert-1s1tntmr.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
20
)
tdSql
.
query
(
"select count(*) from stb00_0"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
tdSql
.
query
(
"select count(*) from stb01_0"
)
tdSql
.
checkData
(
0
,
0
,
200
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
4000
)
# 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。
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insert-interval-speed.json -y"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
10
)
tdSql
.
query
(
"select count(*) from stb00_0"
)
tdSql
.
checkData
(
0
,
0
,
200
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
2000
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
1
,
4
,
20
)
tdSql
.
query
(
"select count(*) from stb01_0"
)
tdSql
.
checkData
(
0
,
0
,
200
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
4000
)
# spend 2min30s for 3 testcases.
# insert: drop and child_table_exists combination test
# insert: using parament "childtable_offset and childtable_limit" to control table'offset point and offset
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insert-nodbnodrop.json -y"
%
binPath
)
tdSql
.
error
(
"show dbno.stables"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insert-newdb.json -y"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
5
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
6
)
tdSql
.
query
(
"select count (tbname) from stb2"
)
tdSql
.
checkData
(
0
,
0
,
7
)
tdSql
.
query
(
"select count (tbname) from stb3"
)
tdSql
.
checkData
(
0
,
0
,
8
)
tdSql
.
query
(
"select count (tbname) from stb4"
)
tdSql
.
checkData
(
0
,
0
,
8
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insert-offset.json -y"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
50
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
240
)
tdSql
.
query
(
"select count(*) from stb2"
)
tdSql
.
checkData
(
0
,
0
,
220
)
tdSql
.
query
(
"select count(*) from stb3"
)
tdSql
.
checkData
(
0
,
0
,
180
)
tdSql
.
query
(
"select count(*) from stb4"
)
tdSql
.
checkData
(
0
,
0
,
160
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insert-newtable.json -y"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
150
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
360
)
tdSql
.
query
(
"select count(*) from stb2"
)
tdSql
.
checkData
(
0
,
0
,
360
)
tdSql
.
query
(
"select count(*) from stb3"
)
tdSql
.
checkData
(
0
,
0
,
340
)
tdSql
.
query
(
"select count(*) from stb4"
)
tdSql
.
checkData
(
0
,
0
,
400
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insert-renewdb.json -y"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
50
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
120
)
tdSql
.
query
(
"select count(*) from stb2"
)
tdSql
.
checkData
(
0
,
0
,
140
)
tdSql
.
query
(
"select count(*) from stb3"
)
tdSql
.
checkData
(
0
,
0
,
160
)
tdSql
.
query
(
"select count(*) from stb4"
)
tdSql
.
checkData
(
0
,
0
,
160
)
# insert: let parament in json file is illegal, it'll expect error.
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insertColumnsAndTagNumLarge4096.json -y "
%
binPath
)
tdSql
.
error
(
"use db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insertSigcolumnsNum4096.json -y "
%
binPath
)
tdSql
.
error
(
"select * from db.stb0"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insertColumnsAndTagNum4096.json -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
checkRows
(
0
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insertColumnsNum0.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables like 'stb0%' "
)
tdSql
.
checkData
(
0
,
2
,
11
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insertTagsNumLarge128.json -y "
%
binPath
)
tdSql
.
error
(
"use db1"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select count(*) from db.stb1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
error
(
"select * from db.stb4"
)
tdSql
.
error
(
"select * from db.stb2"
)
tdSql
.
query
(
"select count(*) from db.stb3"
)
tdSql
.
checkRows
(
1
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151-error.json -y "
%
binPath
)
tdSql
.
error
(
"select * from db.stb4"
)
tdSql
.
error
(
"select * from db.stb2"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insertNumOfrecordPerReq0.json -y "
%
binPath
)
tdSql
.
error
(
"select count(*) from db.stb0"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insertNumOfrecordPerReqless0.json -y "
%
binPath
)
tdSql
.
error
(
"use db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insertChildTab0.json -y "
%
binPath
)
tdSql
.
error
(
"use db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insertChildTabLess0.json -y "
%
binPath
)
tdSql
.
error
(
"use db"
)
tdSql
.
execute
(
"drop database if exists blf"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insertTimestepMulRowsLargeint16.json -y "
%
binPath
)
tdSql
.
execute
(
"use blf"
)
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
.
query
(
"select first(ts) from blf.p_0_topics_2"
)
tdSql
.
checkData
(
0
,
0
,
"2019-10-01 00:00:00"
)
tdSql
.
query
(
"select last(ts) from blf.p_0_topics_6 "
)
tdSql
.
checkData
(
0
,
0
,
"2020-09-29 23:59:00"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insertMaxNumPerReq.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
5000000
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
5000000
)
# insert: timestamp and step
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insert-timestep.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
20
)
tdSql
.
query
(
"select last(ts) from db.stb00_0"
)
tdSql
.
checkData
(
0
,
0
,
"2020-10-01 00:00:00.019000"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
200
)
tdSql
.
query
(
"select last(ts) from db.stb01_0"
)
tdSql
.
checkData
(
0
,
0
,
"2020-11-01 00:00:00.190000"
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
400
)
# # insert: disorder_ratio
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insert-disorder.json -g 2>&1 -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
10
)
# insert: sample json
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insert-sample-ts.json -y "
%
binPath
)
tdSql
.
execute
(
"use dbtest123"
)
tdSql
.
query
(
"select c2 from stb0"
)
tdSql
.
checkData
(
0
,
0
,
2147483647
)
tdSql
.
query
(
"select c0 from stb0_0 order by ts"
)
tdSql
.
checkData
(
3
,
0
,
4
)
tdSql
.
query
(
"select count(*) from stb0 order by ts"
)
tdSql
.
checkData
(
0
,
0
,
40
)
tdSql
.
query
(
"select * from stb0_1 order by ts"
)
tdSql
.
checkData
(
0
,
0
,
'2021-10-28 15:34:44.735'
)
tdSql
.
checkData
(
3
,
0
,
'2021-10-31 15:34:44.735'
)
tdSql
.
query
(
"select * from stb1 where t1=-127"
)
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
"select * from stb1 where t2=127"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select * from stb1 where t2=126"
)
tdSql
.
checkRows
(
10
)
# insert: sample json
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insert-sample.json -y "
%
binPath
)
tdSql
.
execute
(
"use dbtest123"
)
tdSql
.
query
(
"select c2 from stb0"
)
tdSql
.
checkData
(
0
,
0
,
2147483647
)
tdSql
.
query
(
"select * from stb1 where t1=-127"
)
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
"select * from stb1 where t2=127"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select * from stb1 where t2=126"
)
tdSql
.
checkRows
(
10
)
# insert: test interlace parament
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insert-interlace-row.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"select count (*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
15000
)
# # insert: auto_create
tdSql
.
execute
(
'drop database if exists db'
)
tdSql
.
execute
(
'create database db'
)
tdSql
.
execute
(
'use db'
)
os
.
system
(
"%staosBenchmark -y -f tools/taosdemoAllTest/insert-drop-exist-auto-N00.json "
%
binPath
)
# drop = no, child_table_exists, auto_create_table varies
tdSql
.
execute
(
'use db'
)
tdSql
.
query
(
'show tables like
\'
NN123%
\'
'
)
#child_table_exists = no, auto_create_table varies = 123
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
'show tables like
\'
NNN%
\'
'
)
#child_table_exists = no, auto_create_table varies = no
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
'show tables like
\'
NNY%
\'
'
)
#child_table_exists = no, auto_create_table varies = yes
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
'show tables like
\'
NYN%
\'
'
)
#child_table_exists = yes, auto_create_table varies = no
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
'show tables like
\'
NY123%
\'
'
)
#child_table_exists = yes, auto_create_table varies = 123
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
'show tables like
\'
NYY%
\'
'
)
#child_table_exists = yes, auto_create_table varies = yes
tdSql
.
checkRows
(
0
)
tdSql
.
execute
(
'drop database if exists db'
)
os
.
system
(
"%staosBenchmark -y -f tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json "
%
binPath
)
# drop = yes, child_table_exists, auto_create_table varies
tdSql
.
execute
(
'use db'
)
tdSql
.
query
(
'show tables like
\'
YN123%
\'
'
)
#child_table_exists = no, auto_create_table varies = 123
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
'show tables like
\'
YNN%
\'
'
)
#child_table_exists = no, auto_create_table varies = no
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
'show tables like
\'
YNY%
\'
'
)
#child_table_exists = no, auto_create_table varies = yes
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
'show tables like
\'
YYN%
\'
'
)
#child_table_exists = yes, auto_create_table varies = no
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
'show tables like
\'
YY123%
\'
'
)
#child_table_exists = yes, auto_create_table varies = 123
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
'show tables like
\'
YYY%
\'
'
)
#child_table_exists = yes, auto_create_table varies = yes
tdSql
.
checkRows
(
20
)
# insert: test chinese encoding
# TD-11399、TD-10819
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insert-chinese.json -y "
%
binPath
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/insert-chinese-sml.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
for
i
in
range
(
6
):
for
j
in
range
(
6
):
if
tdSql
.
queryResult
[
i
][
0
]
==
'stb%d'
%
j
:
# print(i,"stb%d"%j)
tdSql
.
checkData
(
i
,
4
,
(
j
+
1
)
*
10
)
for
i
in
range
(
6
):
tdSql
.
query
(
"select count(*) from stb%d"
%
i
)
tdSql
.
checkData
(
0
,
0
,
(
i
+
1
)
*
1000
)
# rm useless files
os
.
system
(
"rm -rf ./insert*_res.txt*"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py
已删除
100644 → 0
浏览文件 @
e0aaab3a
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
os
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
def
run
(
self
):
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
# insert: create one or mutiple tables per sql and insert multiple rows per sql
# line_protocol——telnet and json
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insert-1s1tnt1r-sml.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
20
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
4000
)
# insert: create mutiple tables per sql and insert one rows per sql .
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insert-1s1tntmr-sml.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
15
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
1500
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
3000
)
# 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。
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insert-interval-speed-sml.json -y"
%
binPath
)
tdSql
.
execute
(
"use db"
)
# tdSql.query("select count (tbname) from stb0")
tdSql
.
query
(
"select tbname from db.stb0"
)
tdSql
.
checkRows
(
100
)
# tdSql.query("select count(*) from stb00_0")
# tdSql.checkData(0, 0, 20)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
2000
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
1
,
4
,
20
)
# tdSql.query("select count(*) from stb01_0")
# tdSql.checkData(0, 0, 35)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
700
)
# spend 2min30s for 3 testcases.
# insert: drop and child_table_exists combination test
# insert: sml can't support parament "childtable_offset and childtable_limit" \ drop=no or child_table_exists = yes
# os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-nodbnodrop-sml.json -y" % binPath)
# tdSql.error("show dbno.stables")
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insert-newdb-sml.json -y"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
5
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
6
)
tdSql
.
query
(
"select count (tbname) from stb2"
)
tdSql
.
checkData
(
0
,
0
,
7
)
tdSql
.
query
(
"select count (tbname) from stb3"
)
tdSql
.
checkData
(
0
,
0
,
8
)
tdSql
.
query
(
"select count (tbname) from stb4"
)
tdSql
.
checkData
(
0
,
0
,
8
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insert-renewdb-sml.json -y"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
50
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
120
)
tdSql
.
query
(
"select count(*) from stb2"
)
tdSql
.
checkData
(
0
,
0
,
140
)
tdSql
.
query
(
"select count(*) from stb3"
)
tdSql
.
checkData
(
0
,
0
,
160
)
tdSql
.
query
(
"select count(*) from stb4"
)
tdSql
.
checkData
(
0
,
0
,
160
)
# insert: let parament in json file is illegal, it'll expect error.
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insertColumnsAndTagNumLarge4096-sml.json -y "
%
binPath
)
tdSql
.
error
(
"use db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insertSigcolumnsNum4096-sml.json -y "
%
binPath
)
tdSql
.
error
(
"select * from db.stb0"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insertColumnsAndTagNum4096-sml.json -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
checkData
(
0
,
0
,
10000
)
# there is no limit of 4096 columns,so cancels this case
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertInterlaceRowsLarge1M-sml.json -y " % binPath)
# tdSql.query("select count(*) from db.stb0")
# tdSql.checkRows(0)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insertColumnsNum0-sml.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables like 'stb0%' "
)
tdSql
.
checkData
(
0
,
2
,
11
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insertTagsNumLarge128-sml.json -y "
%
binPath
)
tdSql
.
error
(
"use db1"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-sml.json -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select count(*) from db.stb1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select count(*) from db.stb3"
)
tdSql
.
checkRows
(
1
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insertBinaryLenLarge16374AllcolLar49151-error-sml.json -y "
%
binPath
)
tdSql
.
error
(
"select * from db.stb4"
)
tdSql
.
error
(
"select * from db.stb2"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insertNumOfrecordPerReq0-sml.json -y "
%
binPath
)
tdSql
.
error
(
"select count(*) from db.stb0"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insertNumOfrecordPerReqless0-sml.json -y "
%
binPath
)
tdSql
.
error
(
"use db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insertChildTab0-sml.json -y "
%
binPath
)
tdSql
.
error
(
"use db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insertChildTabLess0-sml.json -y "
%
binPath
)
tdSql
.
error
(
"use db"
)
tdSql
.
execute
(
"drop database if exists blf"
)
# child table name is invalid reading,so
# os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertTimestepMulRowsLargeint16-sml.json -y " % binPath)
# tdSql.execute("use blf")
# 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.query("select first(ts) from blf.p_0_topics_2")
# tdSql.checkData(0, 0, "2019-10-01 00:00:00")
# tdSql.query("select last(ts) from blf.p_0_topics_6 ")
# tdSql.checkData(0, 0, "2020-09-29 23:59:00")
# it will be commented in ci because it spend too much time to insert data, but when you can excute it when you want to test this case.
# os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertMaxNumPerReq-sml.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 5000000)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 5000000)
# os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertMaxNumPerReq-sml-telnet.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 5000000)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 5000000)
# insert: timestamp and step
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insert-timestep-sml.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
20
)
# tdSql.query("select last(ts) from db.stb00_0")
# tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000")
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
200
)
# tdSql.query("select last(ts) from db.stb01_0")
# tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000")
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
400
)
# # insert: disorder_ratio
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insert-disorder-sml.json 2>&1 -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
10
)
# insert: doesn‘t currently supported sample json
assert
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sample-sml.json -y "
%
binPath
)
!=
0
# tdSql.execute("use dbtest123")
# tdSql.query("select c2 from stb0")
# tdSql.checkData(0, 0, 2147483647)
# tdSql.query("select * from stb1 where t1=-127")
# tdSql.checkRows(20)
# tdSql.query("select * from stb1 where t2=127")
# tdSql.checkRows(10)
# tdSql.query("select * from stb1 where t2=126")
# tdSql.checkRows(10)
# insert: test interlace parament
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/sml/insert-interlace-row-sml.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"select count (*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
15000
)
testcaseFilename
=
os
.
path
.
split
(
__file__
)[
-
1
]
os
.
system
(
"rm -rf ./insert_res.txt"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/%s.sql"
%
testcaseFilename
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py
已删除
100644 → 0
浏览文件 @
e0aaab3a
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
os
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
def
run
(
self
):
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
# insert: create one or mutiple tables per sql and insert multiple rows per sql
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-1s1tnt1r-stmt.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
1000
)
tdSql
.
query
(
"select count(*) from stb00_0"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
100000
)
tdSql
.
query
(
"select count(*) from stb01_1"
)
tdSql
.
checkData
(
0
,
0
,
200
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
200000
)
# insert: create mutiple tables per sql and insert one rows per sql .
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-1s1tntmr-stmt.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
20
)
tdSql
.
query
(
"select count(*) from stb00_0"
)
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
100000
)
tdSql
.
query
(
"select count(*) from stb01_0"
)
tdSql
.
checkData
(
0
,
0
,
20000
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
400000
)
# 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。
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-interval-speed-stmt.json -y"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
100
)
tdSql
.
query
(
"select count(*) from stb00_0"
)
tdSql
.
checkData
(
0
,
0
,
20000
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
2000000
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
1
,
4
,
100
)
tdSql
.
query
(
"select count(*) from stb01_0"
)
tdSql
.
checkData
(
0
,
0
,
20000
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
2000000
)
# spend 2min30s for 3 testcases.
# insert: drop and child_table_exists combination test
# insert: using parament "childtable_offset and childtable_limit" to control table'offset point and offset
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-nodbnodrop-stmt.json -y"
%
binPath
)
tdSql
.
error
(
"show dbno.stables"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-newdb-stmt.json -y"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
5
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
6
)
tdSql
.
query
(
"select count (tbname) from stb2"
)
tdSql
.
checkData
(
0
,
0
,
7
)
tdSql
.
query
(
"select count (tbname) from stb3"
)
tdSql
.
checkData
(
0
,
0
,
8
)
tdSql
.
query
(
"select count (tbname) from stb4"
)
tdSql
.
checkData
(
0
,
0
,
8
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-offset-stmt.json -y"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
50
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
240
)
tdSql
.
query
(
"select count(*) from stb2"
)
tdSql
.
checkData
(
0
,
0
,
220
)
tdSql
.
query
(
"select count(*) from stb3"
)
tdSql
.
checkData
(
0
,
0
,
180
)
tdSql
.
query
(
"select count(*) from stb4"
)
tdSql
.
checkData
(
0
,
0
,
160
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-newtable-stmt.json -y"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
150
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
360
)
tdSql
.
query
(
"select count(*) from stb2"
)
tdSql
.
checkData
(
0
,
0
,
360
)
tdSql
.
query
(
"select count(*) from stb3"
)
tdSql
.
checkData
(
0
,
0
,
340
)
tdSql
.
query
(
"select count(*) from stb4"
)
tdSql
.
checkData
(
0
,
0
,
400
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-renewdb-stmt.json -y"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
50
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
120
)
tdSql
.
query
(
"select count(*) from stb2"
)
tdSql
.
checkData
(
0
,
0
,
140
)
tdSql
.
query
(
"select count(*) from stb3"
)
tdSql
.
checkData
(
0
,
0
,
160
)
tdSql
.
query
(
"select count(*) from stb4"
)
tdSql
.
checkData
(
0
,
0
,
160
)
# insert: let parament in json file is illegal, it'll expect error.
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insertColumnsAndTagNumLarge4096-stmt.json -y "
%
binPath
)
tdSql
.
error
(
"use db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insertSigcolumnsNum4096-stmt.json -y "
%
binPath
)
tdSql
.
error
(
"select * from db.stb0"
)
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/insertColumnsAndTagNum4096-stmt.json -y " % binPath)
# tdSql.query("select count(*) from db.stb0")
# tdSql.checkData(0, 0, 10000)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insertInterlaceRowsLarge1M-stmt.json -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
checkRows
(
0
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insertColumnsNum0-stmt.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables like 'stb0%' "
)
tdSql
.
checkData
(
0
,
2
,
11
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insertTagsNumLarge128-stmt.json -y "
%
binPath
)
tdSql
.
error
(
"use db1"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-stmt.json -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from db.stb0"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select count(*) from db.stb1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
error
(
"select * from db.stb4"
)
tdSql
.
error
(
"select * from db.stb2"
)
tdSql
.
query
(
"select count(*) from db.stb3"
)
tdSql
.
checkRows
(
1
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insertBinaryLenLarge16374AllcolLar49151-error-stmt.json -y "
%
binPath
)
tdSql
.
error
(
"select * from db.stb4"
)
tdSql
.
error
(
"select * from db.stb2"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insertNumOfrecordPerReq0-stmt.json -y "
%
binPath
)
tdSql
.
error
(
"select count(*) from db.stb0"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insertNumOfrecordPerReqless0-stmt.json -y "
%
binPath
)
tdSql
.
error
(
"use db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insertChildTab0-stmt.json -y "
%
binPath
)
tdSql
.
error
(
"use db"
)
tdSql
.
execute
(
"drop database if exists db"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insertChildTabLess0-stmt.json -y "
%
binPath
)
tdSql
.
error
(
"use db"
)
tdSql
.
execute
(
"drop database if exists blf"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insertTimestepMulRowsLargeint16-stmt.json -y "
%
binPath
)
tdSql
.
execute
(
"use blf"
)
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
.
query
(
"select first(ts) from blf.p_0_topics_2"
)
tdSql
.
checkData
(
0
,
0
,
"2019-10-01 00:00:00"
)
tdSql
.
query
(
"select last(ts) from blf.p_0_topics_6 "
)
tdSql
.
checkData
(
0
,
0
,
"2020-09-29 23:59:00"
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insertMaxNumPerReq-stmt.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
5000000
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
5000000
)
# insert: sample json
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-sample-ts-stmt.json -y "
%
binPath
)
tdSql
.
execute
(
"use dbtest123"
)
tdSql
.
query
(
"select c2 from stb0"
)
tdSql
.
checkData
(
0
,
0
,
2147483647
)
tdSql
.
query
(
"select c0 from stb0_0 order by ts"
)
tdSql
.
checkData
(
3
,
0
,
4
)
tdSql
.
query
(
"select count(*) from stb0 order by ts"
)
tdSql
.
checkData
(
0
,
0
,
40
)
tdSql
.
query
(
"select * from stb0_1 order by ts"
)
tdSql
.
checkData
(
0
,
0
,
'2021-10-28 15:34:44.735'
)
tdSql
.
checkData
(
3
,
0
,
'2021-10-31 15:34:44.735'
)
tdSql
.
query
(
"select * from stb1 where t1=-127"
)
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
"select * from stb1 where t2=127"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select * from stb1 where t2=126"
)
tdSql
.
checkRows
(
10
)
# insert: timestamp and step
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-timestep-stmt.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
20
)
tdSql
.
query
(
"select last(ts) from db.stb00_0"
)
tdSql
.
checkData
(
0
,
0
,
"2020-10-01 00:00:00.019000"
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
200
)
tdSql
.
query
(
"select last(ts) from db.stb01_0"
)
tdSql
.
checkData
(
0
,
0
,
"2020-11-01 00:00:00.190000"
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
400
)
# # insert: disorder_ratio
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-disorder-stmt.json 2>&1 -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
query
(
"select count (tbname) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count(*) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
10
)
# insert: sample json
#os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-sample-stmt.json -y " % binPath)
#tdSql.execute("use dbtest123")
#tdSql.query("select c2 from stb0")
#tdSql.checkData(0, 0, 2147483647)
#tdSql.query("select * from stb1 where t1=-127")
#tdSql.checkRows(20)
#tdSql.query("select * from stb1 where t2=127")
#tdSql.checkRows(10)
#tdSql.query("select * from stb1 where t2=126")
#tdSql.checkRows(10)
# insert: test interlace parament
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-interlace-row-stmt.json -y "
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"select count (*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
15000
)
# insert: auto_create
tdSql
.
execute
(
'drop database if exists db'
)
tdSql
.
execute
(
'create database db'
)
tdSql
.
execute
(
'use db'
)
os
.
system
(
"%staosBenchmark -y -f tools/taosdemoAllTest/stmt/insert-drop-exist-auto-N00-stmt.json "
%
binPath
)
# drop = no, child_table_exists, auto_create_table varies
tdSql
.
execute
(
'use db'
)
tdSql
.
query
(
'show tables like
\'
NN123%
\'
'
)
#child_table_exists = no, auto_create_table varies = 123
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
'show tables like
\'
NNN%
\'
'
)
#child_table_exists = no, auto_create_table varies = no
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
'show tables like
\'
NNY%
\'
'
)
#child_table_exists = no, auto_create_table varies = yes
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
'show tables like
\'
NYN%
\'
'
)
#child_table_exists = yes, auto_create_table varies = no
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
'show tables like
\'
NY123%
\'
'
)
#child_table_exists = yes, auto_create_table varies = 123
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
'show tables like
\'
NYY%
\'
'
)
#child_table_exists = yes, auto_create_table varies = yes
tdSql
.
checkRows
(
0
)
tdSql
.
execute
(
'drop database if exists db'
)
os
.
system
(
"%staosBenchmark -y -f tools/taosdemoAllTest/stmt/insert-drop-exist-auto-Y00-stmt.json "
%
binPath
)
# drop = yes, child_table_exists, auto_create_table varies
tdSql
.
execute
(
'use db'
)
tdSql
.
query
(
'show tables like
\'
YN123%
\'
'
)
#child_table_exists = no, auto_create_table varies = 123
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
'show tables like
\'
YNN%
\'
'
)
#child_table_exists = no, auto_create_table varies = no
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
'show tables like
\'
YNY%
\'
'
)
#child_table_exists = no, auto_create_table varies = yes
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
'show tables like
\'
YYN%
\'
'
)
#child_table_exists = yes, auto_create_table varies = no
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
'show tables like
\'
YY123%
\'
'
)
#child_table_exists = yes, auto_create_table varies = 123
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
'show tables like
\'
YYY%
\'
'
)
#child_table_exists = yes, auto_create_table varies = yes
tdSql
.
checkRows
(
20
)
testcaseFilename
=
os
.
path
.
split
(
__file__
)[
-
1
]
os
.
system
(
"rm -rf ./insert_res.txt"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/%s.sql"
%
testcaseFilename
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmtPerformance.py
已删除
100644 → 0
浏览文件 @
e0aaab3a
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
os
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
# tdSql.init(conn.cursor(), logSql)
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
def
run
(
self
):
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
# insert: create one or mutiple tables per sql and insert multiple rows per sql
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/stmt/1174-small-stmt-random.json -y "
%
binPath
)
# sleep(60)
# os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/1174-small-taosc.json -y " % binPath)
# sleep(60)
# os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/1174-small-stmt.json -y " % binPath)
# sleep(60)
# os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/1174-large-taosc.json -y " % binPath)
# sleep(60)
# os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/1174-large-stmt.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("select count (tbname) from stb0")
# tdSql.checkData(0, 0, 1000)
# tdSql.query("select count (tbname) from stb1")
# tdSql.checkData(0, 0, 1000)
# tdSql.query("select count(*) from stb00_0")
# tdSql.checkData(0, 0, 100)
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 100000)
# tdSql.query("select count(*) from stb01_1")
# tdSql.checkData(0, 0, 200)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 200000)
testcaseFilename
=
os
.
path
.
split
(
__file__
)[
-
1
]
os
.
system
(
"rm -rf ./insert_res.txt"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/%s.sql"
%
testcaseFilename
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py
已删除
100644 → 0
浏览文件 @
e0aaab3a
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
os
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
import
time
from
datetime
import
datetime
import
ast
import
re
# from assertpy import assert_that
import
subprocess
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
# 获取taosc接口查询的结果文件中的内容,返回每行数据,并断言数据的第一列内容。
def
assertfileDataTaosc
(
self
,
filename
,
expectResult
):
self
.
filename
=
filename
self
.
expectResult
=
expectResult
with
open
(
"%s"
%
filename
,
'r+'
)
as
f1
:
for
line
in
f1
.
readlines
():
queryResultTaosc
=
line
.
strip
().
split
()[
0
]
self
.
assertCheck
(
filename
,
queryResultTaosc
,
expectResult
)
# 获取restful接口查询的结果文件中的关键内容,目前的关键内容找到第一个key就跳出循,所以就只有一个数据。后续再修改多个结果文件。
def
getfileDataRestful
(
self
,
filename
):
self
.
filename
=
filename
with
open
(
"%s"
%
filename
,
'r+'
)
as
f1
:
for
line
in
f1
.
readlines
():
contents
=
line
.
strip
()
if
contents
.
find
(
"data"
)
!=
-
1
:
pattern
=
re
.
compile
(
"{.*}"
)
contents
=
pattern
.
search
(
contents
).
group
()
contentsDict
=
ast
.
literal_eval
(
contents
)
# 字符串转换为字典
queryResultRest
=
contentsDict
[
'data'
][
0
][
0
]
break
else
:
queryResultRest
=
""
return
queryResultRest
# 获取taosc接口查询次数
def
queryTimesTaosc
(
self
,
filename
):
self
.
filename
=
filename
command
=
'cat %s |wc -l'
%
filename
times
=
int
(
subprocess
.
getstatusoutput
(
command
)[
1
])
return
times
# 获取restful接口查询次数
def
queryTimesRestful
(
self
,
filename
):
self
.
filename
=
filename
command
=
'cat %s |grep "200 OK" |wc -l'
%
filename
times
=
int
(
subprocess
.
getstatusoutput
(
command
)[
1
])
return
times
# 定义断言结果是否正确。不正确返回错误结果,正确即通过。
def
assertCheck
(
self
,
filename
,
queryResult
,
expectResult
):
self
.
filename
=
filename
self
.
queryResult
=
queryResult
self
.
expectResult
=
expectResult
args0
=
(
filename
,
queryResult
,
expectResult
)
assert
queryResult
==
expectResult
,
"Queryfile:%s ,result is %s != expect: %s"
%
args0
def
run
(
self
):
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
# delete useless files
os
.
system
(
"rm -rf ./query_res*"
)
os
.
system
(
"rm -rf ./all_query*"
)
# taosc query: query specified table and query super table
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/queryInsertdata.json"
%
binPath
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/queryTaosc.json"
%
binPath
)
os
.
system
(
"cat query_res0.txt* > all_query_res0_taosc.txt"
)
os
.
system
(
"cat query_res1.txt* > all_query_res1_taosc.txt"
)
os
.
system
(
"cat query_res2.txt* > all_query_res2_taosc.txt"
)
# correct Times testcases
queryTimes0Taosc
=
self
.
queryTimesTaosc
(
"all_query_res0_taosc.txt"
)
self
.
assertCheck
(
"all_query_res0_taosc.txt"
,
queryTimes0Taosc
,
6
)
queryTimes1Taosc
=
self
.
queryTimesTaosc
(
"all_query_res1_taosc.txt"
)
self
.
assertCheck
(
"all_query_res1_taosc.txt"
,
queryTimes1Taosc
,
6
)
queryTimes2Taosc
=
self
.
queryTimesTaosc
(
"all_query_res2_taosc.txt"
)
self
.
assertCheck
(
"all_query_res2_taosc.txt"
,
queryTimes2Taosc
,
20
)
# correct data testcase
self
.
assertfileDataTaosc
(
"all_query_res0_taosc.txt"
,
"1604160000099"
)
self
.
assertfileDataTaosc
(
"all_query_res1_taosc.txt"
,
"100"
)
self
.
assertfileDataTaosc
(
"all_query_res2_taosc.txt"
,
"1604160000199"
)
# delete useless files
os
.
system
(
"rm -rf ./query_res*"
)
os
.
system
(
"rm -rf ./all_query*"
)
# use restful api to query
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/queryInsertrestdata.json"
%
binPath
)
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/queryRestful.json"
%
binPath
)
os
.
system
(
"cat query_res0.txt* > all_query_res0_rest.txt"
)
os
.
system
(
"cat query_res1.txt* > all_query_res1_rest.txt"
)
os
.
system
(
"cat query_res2.txt* > all_query_res2_rest.txt"
)
# correct Times testcases
queryTimes0Restful
=
self
.
queryTimesRestful
(
"all_query_res0_rest.txt"
)
self
.
assertCheck
(
"all_query_res0_rest.txt"
,
queryTimes0Restful
,
6
)
queryTimes1Restful
=
self
.
queryTimesRestful
(
"all_query_res1_rest.txt"
)
self
.
assertCheck
(
"all_query_res1_rest.txt"
,
queryTimes1Restful
,
6
)
queryTimes2Restful
=
self
.
queryTimesRestful
(
"all_query_res2_rest.txt"
)
self
.
assertCheck
(
"all_query_res2_rest.txt"
,
queryTimes2Restful
,
4
)
# correct data testcase
data0
=
self
.
getfileDataRestful
(
"all_query_res0_rest.txt"
)
self
.
assertCheck
(
'all_query_res0_rest.txt'
,
data0
,
"2020-11-01 00:00:00.009"
)
data1
=
self
.
getfileDataRestful
(
"all_query_res1_rest.txt"
)
self
.
assertCheck
(
'all_query_res1_rest.txt'
,
data1
,
10
)
data2
=
self
.
getfileDataRestful
(
"all_query_res2_rest.txt"
)
self
.
assertCheck
(
'all_query_res2_rest.txt'
,
data2
,
"2020-11-01 00:00:00.004"
)
# query times less than or equal to 100
assert
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/queryInsertdata.json"
%
binPath
)
==
0
assert
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/querySpeciMutisql100.json"
%
binPath
)
!=
0
assert
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/querySuperMutisql100.json"
%
binPath
)
==
0
# query result print QPS
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/queryInsertdata.json"
%
binPath
)
exceptcode
=
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/queryQps.json"
%
binPath
)
assert
exceptcode
==
0
# use illegal or out of range parameters query json file
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/queryInsertdata.json"
%
binPath
)
exceptcode
=
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/queryTimes0.json"
%
binPath
)
assert
exceptcode
!=
0
exceptcode0
=
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/queryTimesless0.json"
%
binPath
)
assert
exceptcode0
!=
0
exceptcode1
=
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/queryConcurrentless0.json"
%
binPath
)
assert
exceptcode1
!=
0
exceptcode2
=
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/queryConcurrent0.json"
%
binPath
)
assert
exceptcode2
!=
0
exceptcode3
=
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/querrThreadsless0.json"
%
binPath
)
assert
exceptcode3
!=
0
exceptcode4
=
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/querrThreads0.json"
%
binPath
)
assert
exceptcode4
!=
0
# delete useless files
os
.
system
(
"rm -rf ./insert_res.txt"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/*.py.sql"
)
os
.
system
(
"rm -rf ./querySystemInfo*"
)
os
.
system
(
"rm -rf ./query_res*"
)
os
.
system
(
"rm -rf ./all_query*"
)
os
.
system
(
"rm -rf ./test_query_res0.txt"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/tools/taosdemoAllTest/taosdemoTestSubWithJsonAsync.py
已删除
100644 → 0
浏览文件 @
e0aaab3a
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
os
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
import
time
from
datetime
import
datetime
import
subprocess
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
# 获取订阅次数
def
subTimes
(
self
,
filename
):
self
.
filename
=
filename
command
=
'cat %s |wc -l'
%
filename
times
=
int
(
subprocess
.
getstatusoutput
(
command
)[
1
])
return
times
def
assertCheck
(
self
,
filename
,
queryResult
,
expectResult
):
self
.
filename
=
filename
self
.
queryResult
=
queryResult
self
.
expectResult
=
expectResult
args0
=
(
filename
,
queryResult
,
expectResult
)
assert
queryResult
==
expectResult
,
"Queryfile:%s ,result is %s != expect: %s"
%
args0
def
run
(
self
):
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
# clear env
os
.
system
(
"ps -ef |grep 'taosdemoAllTest/subAsync.json' |grep -v 'grep' |awk '{print $2}'|xargs kill -9"
)
sleep
(
1
)
os
.
system
(
"rm -rf ./subscribe_res*"
)
os
.
system
(
"rm -rf ./all_subscribe_res*"
)
# subscribe: resultfile
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/subInsertdata.json"
%
binPath
)
os
.
system
(
"nohup %staosBenchmark -f tools/taosdemoAllTest/subAsync.json &"
%
binPath
)
query_pid
=
int
(
subprocess
.
getstatusoutput
(
'ps aux|grep "taosdemoAllTest/subAsync.json" |grep -v "grep"|awk
\'
{print $2}
\'
'
)[
1
])
# insert extral data
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"insert into stb00_0 values(1614218412000,'R','bf3',8637,98.861045)"
)
tdSql
.
execute
(
"insert into stb00_1 values(1614218412000,'R','bf3',8637,78.861045)(1614218422000,'R','bf3',8637,98.861045)"
)
sleep
(
5
)
# merge result files
os
.
system
(
"cat subscribe_res0.txt* > all_subscribe_res0.txt"
)
os
.
system
(
"cat subscribe_res1.txt* > all_subscribe_res1.txt"
)
os
.
system
(
"cat subscribe_res2.txt* > all_subscribe_res2.txt"
)
os
.
system
(
"cat subscribe_res3.txt* > all_subscribe_res3.txt"
)
# correct subscribeTimes testcase
subTimes0
=
self
.
subTimes
(
"all_subscribe_res0.txt"
)
self
.
assertCheck
(
"all_subscribe_res0.txt"
,
subTimes0
,
22
)
subTimes1
=
self
.
subTimes
(
"all_subscribe_res1.txt"
)
self
.
assertCheck
(
"all_subscribe_res1.txt"
,
subTimes1
,
24
)
subTimes2
=
self
.
subTimes
(
"all_subscribe_res2.txt"
)
self
.
assertCheck
(
"all_subscribe_res2.txt"
,
subTimes2
,
21
)
subTimes3
=
self
.
subTimes
(
"all_subscribe_res3.txt"
)
self
.
assertCheck
(
"all_subscribe_res3.txt"
,
subTimes3
,
13
)
# correct data testcase
os
.
system
(
"kill -9 %d"
%
query_pid
)
# # query times less than or equal to 100
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/subInsertdataMaxsql100.json"
%
binPath
)
assert
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/subSyncSpecMaxsql100.json"
%
binPath
)
!=
0
assert
os
.
system
(
"%staosBenchmark -f tools/taosdemoAllTest/subSyncSuperMaxsql100.json"
%
binPath
)
!=
0
# delete useless files
os
.
system
(
"rm -rf ./insert_res.txt"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/*.py.sql"
)
os
.
system
(
"rm -rf ./subscribe_res*"
)
os
.
system
(
"rm -rf ./all_subscribe*"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/tools/taosdemoTestInterlace.py
浏览文件 @
5917291d
...
...
@@ -25,7 +25,7 @@ class TDTestCase:
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosBenchmark"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -33,24 +33,23 @@ class TDTestCase:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
buildPath
=
""
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
run
(
self
):
tdSql
.
prepare
()
b
uildPath
=
self
.
getBuildPath
(
)
if
(
b
uild
Path
==
""
):
tdLog
.
exit
(
"taos
d
not found!"
)
b
inPath
=
self
.
getPath
(
"taosBenchmark"
)
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taos
Benchmark
not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
taosdemoCmd
=
"%staosBenchmark -f tools/insert-interlace.json -G 2>&1 | grep sleep | wc -l"
%
binPath
tdLog
.
info
(
"taosBenchmark found in %s"
%
binPath
)
taosdemoCmd
=
"%s -f tools/insert-interlace.json -G 2>&1 | grep sleep | wc -l"
%
binPath
sleepTimes
=
subprocess
.
check_output
(
taosdemoCmd
,
shell
=
True
).
decode
(
"utf-8"
)
print
(
"sleep times: %d"
%
int
(
sleepTimes
))
...
...
tests/pytest/tools/taosdemoTestLimitOffset.py
浏览文件 @
5917291d
...
...
@@ -27,7 +27,7 @@ class TDTestCase:
self
.
numberOfTables
=
10000
self
.
numberOfRecords
=
100
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosBenchmark"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -35,24 +35,28 @@ class TDTestCase:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
run
(
self
):
tdSql
.
prepare
()
b
uildPath
=
self
.
getBuildPath
(
)
if
(
b
uild
Path
==
""
):
b
inPath
=
self
.
getPath
(
"taosBenchmark"
)
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
os
.
system
(
"%staosBenchmark -f tools/insert-tblimit-tboffset-createdb.json"
%
binPath
)
os
.
system
(
"%staosBenchmark -f tools/insert-tblimit-tboffset-insertrec.json"
%
binPath
)
tdLog
.
info
(
"taosd found in %s"
%
binPath
)
os
.
system
(
"%s -f tools/insert-tblimit-tboffset-createdb.json"
%
binPath
)
os
.
system
(
"%s -f tools/insert-tblimit-tboffset-insertrec.json"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(tbname) from db.stb"
)
...
...
@@ -60,8 +64,10 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from db.stb"
)
tdSql
.
checkData
(
0
,
0
,
33000
)
os
.
system
(
"%staosBenchmark -f tools/insert-tblimit-tboffset-createdb.json"
%
binPath
)
os
.
system
(
"%staosBenchmark -f tools/insert-tblimit-tboffset0.json"
%
binPath
)
os
.
system
(
"%s -f tools/insert-tblimit-tboffset-createdb.json"
%
binPath
)
os
.
system
(
"%s -f tools/insert-tblimit-tboffset0.json"
%
binPath
)
tdSql
.
execute
(
"reset query cache"
)
tdSql
.
execute
(
"use db"
)
...
...
@@ -70,8 +76,10 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from db.stb"
)
tdSql
.
checkData
(
0
,
0
,
20000
)
os
.
system
(
"%staosBenchmark -f tools/insert-tblimit-tboffset-createdb.json"
%
binPath
)
os
.
system
(
"%staosBenchmark -f tools/insert-tblimit1-tboffset.json"
%
binPath
)
os
.
system
(
"%s -f tools/insert-tblimit-tboffset-createdb.json"
%
binPath
)
os
.
system
(
"%s -f tools/insert-tblimit1-tboffset.json"
%
binPath
)
tdSql
.
execute
(
"reset query cache"
)
tdSql
.
execute
(
"use db"
)
...
...
tests/pytest/tools/taosdemoTestSampleData.py
浏览文件 @
5917291d
...
...
@@ -27,7 +27,7 @@ class TDTestCase:
self
.
numberOfTables
=
10000
self
.
numberOfRecords
=
100
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosBenchmark"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -35,23 +35,23 @@ class TDTestCase:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
run
(
self
):
tdSql
.
prepare
()
b
uildPath
=
self
.
getBuildPath
(
)
if
(
b
uild
Path
==
""
):
tdLog
.
exit
(
"taos
d
not found!"
)
b
inPath
=
self
.
getPath
(
"taosBenchmark"
)
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taos
Benchmark
not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
os
.
system
(
"%staosBenchmark -f tools/taosdemo-sampledata.json"
%
binPath
)
tdLog
.
info
(
"taosBenchmark found in %s"
%
binPath
)
os
.
system
(
"%s -f tools/taosdemo-sampledata.json"
%
binPath
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select count(tbname) from db.stb"
)
...
...
tests/pytest/tools/taosdemoTestTblAlt.py
浏览文件 @
5917291d
...
...
@@ -29,8 +29,7 @@ class TDTestCase:
self
.
numberOfTables
=
8
self
.
numberOfRecords
=
1000000
def
getBuildPath
(
self
):
buildPath
=
""
def
getPath
(
self
,
tool
=
"taosBenchmark"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -38,26 +37,26 @@ class TDTestCase:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
and
"taosBenchmark"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
insertDataAndAlterTable
(
self
,
threadID
):
b
uildPath
=
self
.
getBuildPath
(
)
if
(
b
uild
Path
==
""
):
tdLog
.
exit
(
"taos
d or staos
Benchmark not found!"
)
b
inPath
=
self
.
getPath
(
"taosBenchmark"
)
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taosBenchmark not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
tdLog
.
info
(
"taosBenchmark found in %s"
%
binPath
)
if
(
threadID
==
0
):
print
(
"%s
taosBenchmark
-y -t %d -n %d -b INT,INT,INT,INT"
%
(
binPath
,
self
.
numberOfTables
,
self
.
numberOfRecords
))
os
.
system
(
"%s
taosBenchmark
-y -t %d -n %d -b INT,INT,INT,INT"
%
print
(
"%s -y -t %d -n %d -b INT,INT,INT,INT"
%
(
binPath
,
self
.
numberOfTables
,
self
.
numberOfRecords
))
os
.
system
(
"%s -y -t %d -n %d -b INT,INT,INT,INT"
%
(
binPath
,
self
.
numberOfTables
,
self
.
numberOfRecords
))
if
(
threadID
==
1
):
time
.
sleep
(
2
)
...
...
tests/pytest/tools/taosdemoTestWithoutMetric.py
浏览文件 @
5917291d
...
...
@@ -27,7 +27,7 @@ class TDTestCase:
self
.
numberOfTables
=
100
self
.
numberOfRecords
=
1000
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosBenchmark"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -35,32 +35,32 @@ class TDTestCase:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
run
(
self
):
b
uildPath
=
self
.
getBuild
Path
()
if
(
b
uild
Path
==
""
):
tdLog
.
exit
(
"taos
d
not found!"
)
b
inPath
=
self
.
get
Path
()
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taos
Benchmark
not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
os
.
system
(
"%staosBenchmark -N -y -t %d -n %d"
%
tdLog
.
info
(
"taosBenchmark found in %s"
%
binPath
)
os
.
system
(
"%s -N -y -t %d -n %d"
%
(
binPath
,
self
.
numberOfTables
,
self
.
numberOfRecords
))
tdSql
.
query
(
"show databases"
)
for
i
in
range
(
18
):
print
(
tdSql
.
getData
(
0
,
i
)
)
print
(
tdSql
.
getData
(
0
,
i
))
tdSql
.
checkData
(
0
,
2
,
self
.
numberOfTables
)
tdSql
.
execute
(
"use test"
)
tdSql
.
query
(
"select count(*) from test.d%d"
%
(
self
.
numberOfTables
-
1
))
"select count(*) from test.d%d"
%
(
self
.
numberOfTables
-
1
))
tdSql
.
checkData
(
0
,
0
,
self
.
numberOfRecords
)
def
stop
(
self
):
...
...
tests/pytest/tools/taosdemoTestdatatype.py
浏览文件 @
5917291d
...
...
@@ -18,6 +18,7 @@ from util.cases import *
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
...
...
@@ -25,8 +26,8 @@ class TDTestCase:
self
.
numberOfTables
=
10
self
.
numberOfRecords
=
10
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosBenchmark"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -34,61 +35,63 @@ class TDTestCase:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
run
(
self
):
b
uildPath
=
self
.
getBuildPath
(
)
if
(
b
uild
Path
==
""
):
tdLog
.
exit
(
"taos
demo
not found!"
)
b
inPath
=
self
.
getPath
(
"taosBenchmark"
)
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taos
Benchmark
not found!"
)
else
:
tdLog
.
info
(
"taosdemo found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
tdLog
.
info
(
"taosBenchmark found in %s"
%
binPath
)
os
.
system
(
"%s -d test002 -y -t %d -n %d -b INT,nchar
\\
(8
\\
),binary
\\
(16
\\
),binary,nchar -w 8"
%
(
binPath
,
self
.
numberOfTables
,
self
.
numberOfRecords
))
os
.
system
(
"%staosBenchmark -d test002 -y -t %d -n %d -b INT,nchar
\\
(8
\\
),binary
\\
(16
\\
),binary,nchar -w 8"
%
(
binPath
,
self
.
numberOfTables
,
self
.
numberOfRecords
))
tdSql
.
execute
(
'use test002'
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
self
.
numberOfTables
*
self
.
numberOfRecords
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
self
.
numberOfTables
*
self
.
numberOfRecords
)
tdLog
.
info
(
'insert into d1 values(now,100,"abcd1234","abcdefgh12345678","abcdefgh","abcdefgh")'
)
tdSql
.
execute
(
'insert into d1 values(now,100,"abcd1234","abcdefgh12345678","abcdefgh","abcdefgh")'
)
tdLog
.
info
(
'insert into d1 values(now,100,"abcd1234","abcdefgh12345678","abcdefgh","abcdefgh")'
)
tdSql
.
execute
(
'insert into d1 values(now,100,"abcd1234","abcdefgh12345678","abcdefgh","abcdefgh")'
)
tdSql
.
query
(
"select * from meters"
)
tdSql
.
checkRows
(
101
)
tdSql
.
error
(
'insert into d1 values(now,100,"abcd","abcd"'
)
tdSql
.
error
(
'insert into d1 values(now,100,100,100)'
)
os
.
system
(
"%staosBenchmark -d test002 -y -t %d -n %d --data-type INT,nchar
\\
(8
\\
),binary
\\
(16
\\
),binary,nchar -w 8"
%
(
binPath
,
self
.
numberOfTables
,
self
.
numberOfRecords
))
os
.
system
(
"%s -d test002 -y -t %d -n %d --data-type INT,nchar
\\
(8
\\
),binary
\\
(16
\\
),binary,nchar -w 8"
%
(
binPath
,
self
.
numberOfTables
,
self
.
numberOfRecords
))
tdSql
.
execute
(
'use test002'
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
self
.
numberOfTables
*
self
.
numberOfRecords
)
os
.
system
(
"%staosBenchmark
-d test002 -y -t %d -n %d -bINT,nchar
\\
(8
\\
),binary
\\
(16
\\
),binary,nchar -w 8"
%
(
binPath
,
self
.
numberOfTables
,
self
.
numberOfRecords
))
os
.
system
(
"%s
-d test002 -y -t %d -n %d -bINT,nchar
\\
(8
\\
),binary
\\
(16
\\
),binary,nchar -w 8"
%
(
binPath
,
self
.
numberOfTables
,
self
.
numberOfRecords
))
tdSql
.
execute
(
'use test002'
)
tdSql
.
query
(
"select count(*) from meters"
)
tdSql
.
checkData
(
0
,
0
,
self
.
numberOfTables
*
self
.
numberOfRecords
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/tools/taosdumpTest2.py
浏览文件 @
5917291d
...
...
@@ -22,7 +22,7 @@ import string
import
random
class
TDTestCase
:
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
...
...
@@ -32,7 +32,7 @@ class TDTestCase:
self
.
numberOfTables
=
1
self
.
numberOfRecords
=
15000
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosdump"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -40,13 +40,14 @@ class TDTestCase:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosd"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
generateString
(
self
,
length
):
chars
=
string
.
ascii_uppercase
+
string
.
ascii_lowercase
...
...
@@ -71,24 +72,23 @@ class TDTestCase:
break
tdSql
.
execute
(
sql
)
b
uildPath
=
self
.
getBuild
Path
()
if
(
b
uild
Path
==
""
):
b
inPath
=
self
.
get
Path
()
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taosdump not found!"
)
else
:
tdLog
.
info
(
"taosdump found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
tdLog
.
info
(
"taosdump found in %s"
%
binPath
)
os
.
system
(
"rm /tmp/*.sql"
)
os
.
system
(
"rm /tmp/*.avro*"
)
os
.
system
(
"%s
taosdump
--databases db -o /tmp "
%
"%s --databases db -o /tmp "
%
binPath
)
tdSql
.
execute
(
"drop database db"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
0
)
os
.
system
(
"%s
taosdump
-i /tmp -y"
%
binPath
)
os
.
system
(
"%s -i /tmp -y"
%
binPath
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
...
...
@@ -100,23 +100,28 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
'st'
)
tdSql
.
query
(
"select count(*) from t1"
)
tdSql
.
checkData
(
0
,
0
,
self
.
numberOfRecords
)
tdSql
.
checkData
(
0
,
0
,
self
.
numberOfRecords
)
# test case for TS-1225
tdSql
.
execute
(
"create database test"
)
tdSql
.
execute
(
"use test"
)
tdSql
.
execute
(
"create table stb(ts timestamp, c1 binary(16374), c2 binary(16374), c3 binary(16374)) tags(t1 nchar(256))"
)
tdSql
.
execute
(
"insert into t1 using stb tags('t1') values(now, '%s', '%s', '%s')"
%
(
self
.
generateString
(
16374
),
self
.
generateString
(
16374
),
self
.
generateString
(
16374
)))
tdSql
.
execute
(
"create table stb(ts timestamp, c1 binary(16374), c2 binary(16374), c3 binary(16374)) tags(t1 nchar(256))"
)
tdSql
.
execute
(
"insert into t1 using stb tags('t1') values(now, '%s', '%s', '%s')"
%
(
self
.
generateString
(
16374
),
self
.
generateString
(
16374
),
self
.
generateString
(
16374
)))
os
.
system
(
"rm /tmp/*.sql"
)
os
.
system
(
"rm /tmp/*.avro*"
)
os
.
system
(
"%s
taosdump
-D test -o /tmp -y"
%
binPath
)
os
.
system
(
"%s -D test -o /tmp -y"
%
binPath
)
tdSql
.
execute
(
"drop database test"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
os
.
system
(
"%s
taosdump
-i /tmp -y"
%
binPath
)
os
.
system
(
"%s -i /tmp -y"
%
binPath
)
tdSql
.
execute
(
"use test"
)
tdSql
.
error
(
"show vnodes '' "
)
...
...
tests/pytest/tools/taosdumpTest3.py
浏览文件 @
5917291d
...
...
@@ -35,7 +35,7 @@ class TDTestCase:
else
:
return
True
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosdump"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
...
...
@@ -43,166 +43,201 @@ class TDTestCase:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosdump"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
return
buildPath
return
paths
[
0
]
def
run
(
self
):
if
not
os
.
path
.
exists
(
"./taosdumptest"
):
os
.
makedirs
(
"./taosdumptest"
)
for
i
in
range
(
1
,
9
):
if
not
os
.
path
.
exists
(
"./taosdumptest/tmp%d"
%
i
):
os
.
makedirs
(
"./taosdumptest/tmp%d"
%
i
)
for
i
in
range
(
1
,
9
):
if
not
os
.
path
.
exists
(
"./taosdumptest/tmp%d"
%
i
):
os
.
makedirs
(
"./taosdumptest/tmp%d"
%
i
)
else
:
os
.
system
(
"rm -rf ./taosdumptest/tmp%d"
%
i
)
os
.
makedirs
(
"./taosdumptest/tmp%d"
%
i
)
os
.
system
(
"rm -rf ./taosdumptest/tmp%d"
%
i
)
os
.
makedirs
(
"./taosdumptest/tmp%d"
%
i
)
b
uildPath
=
self
.
getBuildPath
(
)
if
(
b
uild
Path
==
""
):
b
inPath
=
self
.
getPath
(
"taosdump"
)
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taosdump not found!"
)
else
:
tdLog
.
info
(
"taosdump found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
tdLog
.
info
(
"taosdump found in %s"
%
binPath
)
# create db1 , one stables and one table ; create general tables
tdSql
.
execute
(
"drop database if exists dp1"
)
tdSql
.
execute
(
"drop database if exists dp2"
)
tdSql
.
execute
(
"create database if not exists dp1"
)
tdSql
.
execute
(
"use dp1"
)
tdSql
.
execute
(
"create stable st0(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int)"
)
tdSql
.
execute
(
"create table st0_0 using st0 tags(0) st0_1 using st0 tags (1) "
)
tdSql
.
execute
(
"insert into st0_0 values(1614218412000,8537,'R')(1614218422000,8538,'E')"
)
tdSql
.
execute
(
"insert into st0_1 values(1614218413000,1537,'A')(1614218423000,1538,'D')"
)
tdSql
.
execute
(
"create table if not exists gt0 (ts timestamp, c0 int, c1 float) "
)
tdSql
.
execute
(
"create table if not exists gt1 (ts timestamp, c0 int, c1 double) "
)
tdSql
.
execute
(
"create stable st0(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int)"
)
tdSql
.
execute
(
"create table st0_0 using st0 tags(0) st0_1 using st0 tags (1) "
)
tdSql
.
execute
(
"insert into st0_0 values(1614218412000,8537,'R')(1614218422000,8538,'E')"
)
tdSql
.
execute
(
"insert into st0_1 values(1614218413000,1537,'A')(1614218423000,1538,'D')"
)
tdSql
.
execute
(
"create table if not exists gt0 (ts timestamp, c0 int, c1 float) "
)
tdSql
.
execute
(
"create table if not exists gt1 (ts timestamp, c0 int, c1 double) "
)
tdSql
.
execute
(
"insert into gt0 values(1614218412000,637,8.861)"
)
tdSql
.
execute
(
"insert into gt1 values(1614218413000,638,8.862)"
)
# create db1 , three stables:stb0,include ctables stb0_0 \ stb0_1,stb1 include ctables stb1_0 and stb1_1
# \stb3,include ctables stb3_0 and stb3_1
# create db1 , three stables:stb0,include ctables stb0_0 \ stb0_1,stb1 include ctables stb1_0 and stb1_1
# \stb3,include ctables stb3_0 and stb3_1
# create general three tables gt0 gt1 gt2
tdSql
.
execute
(
"create database if not exists dp2"
)
tdSql
.
execute
(
"use dp2"
)
tdSql
.
execute
(
"create stable st0(ts timestamp, c01 int, c02 nchar(10)) tags(t1 int)"
)
tdSql
.
execute
(
"create table st0_0 using st0 tags(0) st0_1 using st0 tags(1) "
)
tdSql
.
execute
(
"insert into st0_0 values(1614218412000,8600,'R')(1614218422000,8600,'E')"
)
tdSql
.
execute
(
"insert into st0_1 values(1614218413000,8601,'A')(1614218423000,8601,'D')"
)
tdSql
.
execute
(
"create stable st1(ts timestamp, c11 float, c12 nchar(10)) tags(t1 int)"
)
tdSql
.
execute
(
"create table st1_0 using st1 tags(0) st1_1 using st1 tags(1) "
)
tdSql
.
execute
(
"insert into st1_0 values(1614218412000,8610.1,'R')(1614218422000,8610.1,'E')"
)
tdSql
.
execute
(
"insert into st1_1 values(1614218413000,8611.2,'A')(1614218423000,8611.1,'D')"
)
tdSql
.
execute
(
"create stable st2(ts timestamp, c21 float, c22 nchar(10)) tags(t1 int)"
)
tdSql
.
execute
(
"create table st2_0 using st2 tags(0) st2_1 using st2 tags(1) "
)
tdSql
.
execute
(
"insert into st2_0 values(1614218412000,8620.3,'R')(1614218422000,8620.3,'E')"
)
tdSql
.
execute
(
"insert into st2_1 values(1614218413000,8621.4,'A')(1614218423000,8621.4,'D')"
)
tdSql
.
execute
(
"create table if not exists gt0 (ts timestamp, c00 int, c01 float) "
)
tdSql
.
execute
(
"create table if not exists gt1 (ts timestamp, c10 int, c11 double) "
)
tdSql
.
execute
(
"create table if not exists gt2 (ts timestamp, c20 int, c21 float) "
)
tdSql
.
execute
(
"create stable st0(ts timestamp, c01 int, c02 nchar(10)) tags(t1 int)"
)
tdSql
.
execute
(
"create table st0_0 using st0 tags(0) st0_1 using st0 tags(1) "
)
tdSql
.
execute
(
"insert into st0_0 values(1614218412000,8600,'R')(1614218422000,8600,'E')"
)
tdSql
.
execute
(
"insert into st0_1 values(1614218413000,8601,'A')(1614218423000,8601,'D')"
)
tdSql
.
execute
(
"create stable st1(ts timestamp, c11 float, c12 nchar(10)) tags(t1 int)"
)
tdSql
.
execute
(
"create table st1_0 using st1 tags(0) st1_1 using st1 tags(1) "
)
tdSql
.
execute
(
"insert into st1_0 values(1614218412000,8610.1,'R')(1614218422000,8610.1,'E')"
)
tdSql
.
execute
(
"insert into st1_1 values(1614218413000,8611.2,'A')(1614218423000,8611.1,'D')"
)
tdSql
.
execute
(
"create stable st2(ts timestamp, c21 float, c22 nchar(10)) tags(t1 int)"
)
tdSql
.
execute
(
"create table st2_0 using st2 tags(0) st2_1 using st2 tags(1) "
)
tdSql
.
execute
(
"insert into st2_0 values(1614218412000,8620.3,'R')(1614218422000,8620.3,'E')"
)
tdSql
.
execute
(
"insert into st2_1 values(1614218413000,8621.4,'A')(1614218423000,8621.4,'D')"
)
tdSql
.
execute
(
"create table if not exists gt0 (ts timestamp, c00 int, c01 float) "
)
tdSql
.
execute
(
"create table if not exists gt1 (ts timestamp, c10 int, c11 double) "
)
tdSql
.
execute
(
"create table if not exists gt2 (ts timestamp, c20 int, c21 float) "
)
tdSql
.
execute
(
"insert into gt0 values(1614218412700,8637,78.86155)"
)
tdSql
.
execute
(
"insert into gt1 values(1614218413800,8638,78.862020199)"
)
tdSql
.
execute
(
"insert into gt1 values(1614218413800,8638,78.862020199)"
)
tdSql
.
execute
(
"insert into gt2 values(1614218413900,8639,78.863)"
)
# create
# create
tdSql
.
execute
(
"create database if not exists dp3 precision 'ns'"
)
tdSql
.
execute
(
"use dp3"
)
tdSql
.
execute
(
"create stable st0(ts timestamp, c01 int, c02 nchar(10)) tags(t1 int)"
)
tdSql
.
execute
(
"create table st0_0 using st0 tags(0) st0_1 using st0 tags(1) "
)
tdSql
.
execute
(
"insert into st0_0 values(1614218412000000001,8600,'R')(1614218422000000002,8600,'E')"
)
tdSql
.
execute
(
"insert into st0_1 values(1614218413000000001,8601,'A')(1614218423000000002,8601,'D')"
)
tdSql
.
execute
(
"create stable st0(ts timestamp, c01 int, c02 nchar(10)) tags(t1 int)"
)
tdSql
.
execute
(
"create table st0_0 using st0 tags(0) st0_1 using st0 tags(1) "
)
tdSql
.
execute
(
"insert into st0_0 values(1614218412000000001,8600,'R')(1614218422000000002,8600,'E')"
)
tdSql
.
execute
(
"insert into st0_1 values(1614218413000000001,8601,'A')(1614218423000000002,8601,'D')"
)
# # taosdump stable and general table
os
.
system
(
"%staosdump -o ./taosdumptest/tmp1 -D dp1,dp2 -T 8 "
%
binPath
)
os
.
system
(
"%staosdump -o ./taosdumptest/tmp2 dp1 st0 gt0 -T 8 "
%
binPath
)
os
.
system
(
"%staosdump -o ./taosdumptest/tmp3 dp2 st0 st1_0 gt0 -T 8 "
%
binPath
)
os
.
system
(
"%staosdump -o ./taosdumptest/tmp4 dp2 st0 st2 gt0 gt2 -T 8 "
%
binPath
)
# verify ns
os
.
system
(
"%staosdump -o ./taosdumptest/tmp6 dp3 st0_0 -T 8 "
%
binPath
)
os
.
system
(
"%s -o ./taosdumptest/tmp1 -D dp1,dp2 -T 8 "
%
binPath
)
os
.
system
(
"%s -o ./taosdumptest/tmp2 dp1 st0 gt0 -T 8 "
%
binPath
)
os
.
system
(
"%s -o ./taosdumptest/tmp3 dp2 st0 st1_0 gt0 -T 8 "
%
binPath
)
os
.
system
(
"%s -o ./taosdumptest/tmp4 dp2 st0 st2 gt0 gt2 -T 8 "
%
binPath
)
# verify ns
os
.
system
(
"%s -o ./taosdumptest/tmp6 dp3 st0_0 -T 8 "
%
binPath
)
# verify -D:--database
assert
os
.
system
(
"%staosdump -o ./taosdumptest/tmp5 --databases dp1,dp2 -T 8 "
%
binPath
)
==
0
assert
os
.
system
(
"%s -o ./taosdumptest/tmp5 --databases dp1,dp2 -T 8 "
%
binPath
)
==
0
# verify mixed -D:--database and dbname tbname
assert
os
.
system
(
"%staosdump --databases dp1 -o ./taosdumptest/tmp5 dp2 st0 st1_0 gt0 -T 8 "
%
binPath
)
!=
0
assert
os
.
system
(
"%s --databases dp1 -o ./taosdumptest/tmp5 dp2 st0 st1_0 gt0 -T 8 "
%
binPath
)
!=
0
# verify -N
os
.
system
(
"%staosdump -o ./taosdumptest/tmp7 dp3 st0_0 -N -d null -T 8 "
%
binPath
)
os
.
system
(
"%s -o ./taosdumptest/tmp7 dp3 st0_0 -N -d null -T 8 "
%
binPath
)
# verify -N -s
os
.
system
(
"%staosdump -o ./taosdumptest/tmp8 dp3 st0_0 -N -s -T 8 "
%
binPath
)
os
.
system
(
"%s -o ./taosdumptest/tmp8 dp3 st0_0 -N -s -T 8 "
%
binPath
)
#check taosdumptest/tmp1
#
check taosdumptest/tmp1
tdSql
.
execute
(
"drop database dp1"
)
tdSql
.
execute
(
"drop database dp2"
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/tmp1 -T 8 "
%
binPath
)
os
.
system
(
"%s -i ./taosdumptest/tmp1 -T 8 "
%
binPath
)
tdSql
.
execute
(
"use dp1"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
4
)
tdSql
.
query
(
"select c1 from st0_0 order by ts"
)
tdSql
.
checkData
(
0
,
0
,
8537
)
tdSql
.
checkData
(
0
,
0
,
8537
)
tdSql
.
query
(
"select c2 from st0_1 order by ts"
)
tdSql
.
checkData
(
1
,
0
,
"D"
)
tdSql
.
checkData
(
1
,
0
,
"D"
)
tdSql
.
query
(
"select * from gt0"
)
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.000'
)
tdSql
.
checkData
(
0
,
1
,
637
)
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.000'
)
tdSql
.
checkData
(
0
,
1
,
637
)
tdSql
.
execute
(
"use dp2"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
9
)
tdSql
.
query
(
"select ts from gt0"
)
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.700'
)
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.700'
)
tdSql
.
query
(
"select c10 from gt1"
)
tdSql
.
checkData
(
0
,
0
,
8638
)
tdSql
.
query
(
"select c20 from gt2"
)
tdSql
.
checkData
(
0
,
0
,
8639
)
#check taosdumptest/tmp2
# check taosdumptest/tmp2
tdSql
.
execute
(
"drop database dp1"
)
tdSql
.
execute
(
"drop database dp2"
)
os
.
system
(
"%s
taosdump
-i ./taosdumptest/tmp2 -T 8 "
%
binPath
)
os
.
system
(
"%s -i ./taosdumptest/tmp2 -T 8 "
%
binPath
)
tdSql
.
execute
(
"use dp1"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select c1 from st0_0 order by ts"
)
tdSql
.
checkData
(
0
,
0
,
8537
)
tdSql
.
checkData
(
0
,
0
,
8537
)
tdSql
.
query
(
"select c2 from st0_1 order by ts"
)
tdSql
.
checkData
(
1
,
0
,
"D"
)
tdSql
.
checkData
(
1
,
0
,
"D"
)
tdSql
.
query
(
"select * from gt0"
)
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.000'
)
tdSql
.
checkData
(
0
,
1
,
637
)
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.000'
)
tdSql
.
checkData
(
0
,
1
,
637
)
tdSql
.
error
(
"select count(*) from gt1"
)
tdSql
.
error
(
"use dp2"
)
#check taosdumptest/tmp3
# check taosdumptest/tmp3
tdSql
.
execute
(
"drop database dp1"
)
os
.
system
(
"%s
taosdump -i ./taosdumptest/tmp3 -T 8 "
%
binPath
)
os
.
system
(
"%s
-i ./taosdumptest/tmp3 -T 8 "
%
binPath
)
tdSql
.
execute
(
"use dp2"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
4
)
tdSql
.
query
(
"select count(*) from st1_0"
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
query
(
"select ts from gt0"
)
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.700'
)
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.700'
)
tdSql
.
error
(
"use dp1"
)
tdSql
.
error
(
"select count(*) from st2_0"
)
tdSql
.
error
(
"select count(*) from gt2"
)
#check taosdumptest/tmp4
#
check taosdumptest/tmp4
tdSql
.
execute
(
"drop database dp2"
)
os
.
system
(
"%s
taosdump -i ./taosdumptest/tmp4 -T 8 "
%
binPath
)
os
.
system
(
"%s
-i ./taosdumptest/tmp4 -T 8 "
%
binPath
)
tdSql
.
execute
(
"use dp2"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
2
)
...
...
@@ -223,10 +258,9 @@ class TDTestCase:
tdSql
.
error
(
"select count(*) from st1_1"
)
tdSql
.
error
(
"select count(*) from gt3"
)
#check taosdumptest/tmp5
# check taosdumptest/tmp5
tdSql
.
execute
(
"drop database dp2"
)
os
.
system
(
"%s
taosdump -i ./taosdumptest/tmp5 -T 8 "
%
binPath
)
os
.
system
(
"%s
-i ./taosdumptest/tmp5 -T 8 "
%
binPath
)
tdSql
.
execute
(
"use dp2"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
3
)
...
...
@@ -252,39 +286,39 @@ class TDTestCase:
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
4
)
tdSql
.
query
(
"select c1 from st0_0 order by ts"
)
tdSql
.
checkData
(
0
,
0
,
8537
)
tdSql
.
checkData
(
0
,
0
,
8537
)
tdSql
.
query
(
"select c2 from st0_1 order by ts"
)
tdSql
.
checkData
(
1
,
0
,
"D"
)
tdSql
.
checkData
(
1
,
0
,
"D"
)
tdSql
.
query
(
"select * from gt0"
)
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.000'
)
tdSql
.
checkData
(
0
,
1
,
637
)
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.000'
)
tdSql
.
checkData
(
0
,
1
,
637
)
# check taosdumptest/tmp6
tdSql
.
execute
(
"drop database dp1"
)
tdSql
.
execute
(
"drop database dp2"
)
tdSql
.
execute
(
"drop database dp3"
)
os
.
system
(
"%s
taosdump -i ./taosdumptest/tmp6 -T 8 "
%
binPath
)
os
.
system
(
"%s
-i ./taosdumptest/tmp6 -T 8 "
%
binPath
)
tdSql
.
execute
(
"use dp3"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
16
,
'ns'
)
tdSql
.
checkData
(
0
,
16
,
'ns'
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select count(*) from st0_0"
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
query
(
"select * from st0 order by ts"
)
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.000000001'
)
tdSql
.
checkData
(
0
,
1
,
8600
)
tdSql
.
checkData
(
0
,
0
,
'2021-02-25 10:00:12.000000001'
)
tdSql
.
checkData
(
0
,
1
,
8600
)
# check taosdumptest/tmp7
tdSql
.
execute
(
"drop database dp3"
)
os
.
system
(
"%s
taosdump -i ./taosdumptest/tmp7 -T 8 "
%
binPath
)
os
.
system
(
"%s
-i ./taosdumptest/tmp7 -T 8 "
%
binPath
)
tdSql
.
execute
(
"use dp3"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
16
,
'ms'
)
tdSql
.
checkData
(
0
,
16
,
'ms'
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show tables"
)
...
...
@@ -297,20 +331,20 @@ class TDTestCase:
# check taosdumptest/tmp8
tdSql
.
execute
(
"drop database dp3"
)
os
.
system
(
"%s
taosdump -i ./taosdumptest/tmp8 -T 8 "
%
binPath
)
os
.
system
(
"%s
-i ./taosdumptest/tmp8 -T 8 "
%
binPath
)
tdSql
.
execute
(
"use dp3"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select count(*) from st0_0"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# tdSql.query("select * from st0 order by ts")
# tdSql.checkData(0,0,'2021-02-25 10:00:12.000000001')
# tdSql.checkData(0,1,8600)
for
i
in
range
(
1
,
9
):
os
.
system
(
"rm -rf ./taosdumptest/tmp%d"
%
i
)
for
i
in
range
(
1
,
9
):
os
.
system
(
"rm -rf ./taosdumptest/tmp%d"
%
i
)
os
.
system
(
"rm -rf ./dump_result.txt"
)
os
.
system
(
"rm -rf ./db.csv"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录