Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_44632607
TDengine
提交
7c667191
T
TDengine
项目概览
weixin_44632607
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7c667191
编写于
7月 07, 2020
作者:
S
Shuduo Sang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add python test to cover "alter dnode"
[TD-868]
上级
aa80815f
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
215 addition
and
74 deletion
+215
-74
tests/pytest/alter/alter_table_crash.py
tests/pytest/alter/alter_table_crash.py
+1
-0
tests/pytest/client/client.py
tests/pytest/client/client.py
+3
-0
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+3
-1
tests/pytest/insert/writeDBNonStop.py
tests/pytest/insert/writeDBNonStop.py
+3
-2
tests/pytest/query/filterAllIntTypes.py
tests/pytest/query/filterAllIntTypes.py
+29
-15
tests/pytest/query/queryJoin.py
tests/pytest/query/queryJoin.py
+2
-2
tests/pytest/query/queryMetaData.py
tests/pytest/query/queryMetaData.py
+63
-15
tests/pytest/query/queryMetaPerformace.py
tests/pytest/query/queryMetaPerformace.py
+101
-29
tests/pytest/query/select_last_crash.py
tests/pytest/query/select_last_crash.py
+3
-2
tests/pytest/random-test/random-test-multi-threading-3.py
tests/pytest/random-test/random-test-multi-threading-3.py
+0
-1
tests/pytest/regressiontest.sh
tests/pytest/regressiontest.sh
+2
-2
tests/pytest/smoketest.sh
tests/pytest/smoketest.sh
+4
-4
tests/pytest/util/sql.py
tests/pytest/util/sql.py
+1
-1
未找到文件。
tests/pytest/alter/alter_table_crash.py
浏览文件 @
7c667191
...
@@ -78,5 +78,6 @@ class TDTestCase:
...
@@ -78,5 +78,6 @@ class TDTestCase:
tdSql
.
close
()
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/client/client.py
浏览文件 @
7c667191
...
@@ -40,6 +40,9 @@ class TDTestCase:
...
@@ -40,6 +40,9 @@ class TDTestCase:
ret
=
tdSql
.
query
(
'select server_status() as result'
)
ret
=
tdSql
.
query
(
'select server_status() as result'
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
checkData
(
0
,
0
,
1
)
ret
=
tdSql
.
execute
(
'alter dnode 127.0.0.1 debugFlag 135'
)
tdLog
.
info
(
"alter dnode ret: %d"
%
ret
)
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/fulltest.sh
浏览文件 @
7c667191
#!/bin/bash
#!/bin/bash
ulimit
-c
unlimited
ulimit
-c
unlimited
python3 ./test.py
-f
client/client.py
python3 ./test.py
-f
insert/basic.py
python3 ./test.py
-f
insert/basic.py
python3 ./test.py
-f
insert/int.py
python3 ./test.py
-f
insert/int.py
python3 ./test.py
-f
insert/float.py
python3 ./test.py
-f
insert/float.py
...
@@ -151,3 +150,6 @@ python3 ./test.py -f stream/stream2.py
...
@@ -151,3 +150,6 @@ python3 ./test.py -f stream/stream2.py
#alter table
#alter table
python3 ./test.py
-f
alter/alter_table_crash.py
python3 ./test.py
-f
alter/alter_table_crash.py
# client
python3 ./test.py
-f
client/client.py
tests/pytest/insert/writeDBNonStop.py
浏览文件 @
7c667191
...
@@ -67,7 +67,7 @@ class DBWriteNonStop:
...
@@ -67,7 +67,7 @@ class DBWriteNonStop:
self
.
cursor
.
execute
(
self
.
cursor
.
execute
(
"select first(ts), last(ts), min(speed), max(speed), avg(speed), count(*) from st"
)
"select first(ts), last(ts), min(speed), max(speed), avg(speed), count(*) from st"
)
data
=
self
.
cursor
.
fetchall
()
data
=
self
.
cursor
.
fetchall
()
end
=
datetime
.
now
()
end
=
datetime
.
now
()
self
.
writeDataToCSVFile
(
data
,
(
end
-
start
).
seconds
)
self
.
writeDataToCSVFile
(
data
,
(
end
-
start
).
seconds
)
time
.
sleep
(.
001
)
time
.
sleep
(.
001
)
...
@@ -75,8 +75,9 @@ class DBWriteNonStop:
...
@@ -75,8 +75,9 @@ class DBWriteNonStop:
self
.
cursor
.
close
()
self
.
cursor
.
close
()
self
.
conn
.
close
()
self
.
conn
.
close
()
test
=
DBWriteNonStop
()
test
=
DBWriteNonStop
()
test
.
connectDB
()
test
.
connectDB
()
test
.
createTable
()
test
.
createTable
()
test
.
insertData
()
test
.
insertData
()
test
.
closeConn
()
test
.
closeConn
()
\ No newline at end of file
tests/pytest/query/filterAllIntTypes.py
浏览文件 @
7c667191
...
@@ -89,17 +89,25 @@ class TDTestCase:
...
@@ -89,17 +89,25 @@ class TDTestCase:
tdSql
.
checkRows
(
101
)
tdSql
.
checkRows
(
101
)
# range for int type on column
# range for int type on column
tdSql
.
query
(
"select * from st%s where num > 50 and num < 100"
%
curType
)
tdSql
.
query
(
tdSql
.
checkRows
(
49
)
"select * from st%s where num > 50 and num < 100"
%
curType
)
tdSql
.
checkRows
(
49
)
tdSql
.
query
(
"select * from st%s where num >= 50 and num < 100"
%
curType
)
tdSql
.
query
(
tdSql
.
checkRows
(
50
)
"select * from st%s where num >= 50 and num < 100"
%
curType
)
tdSql
.
checkRows
(
50
)
tdSql
.
query
(
"select * from st%s where num > 50 and num <= 100"
%
curType
)
tdSql
.
query
(
tdSql
.
checkRows
(
50
)
"select * from st%s where num > 50 and num <= 100"
%
curType
)
tdSql
.
checkRows
(
50
)
tdSql
.
query
(
"select * from st%s where num >= 50 and num <= 100"
%
curType
)
tdSql
.
query
(
tdSql
.
checkRows
(
51
)
"select * from st%s where num >= 50 and num <= 100"
%
curType
)
tdSql
.
checkRows
(
51
)
# > for int type on tag
# > for int type on tag
tdSql
.
query
(
"select * from st%s where id > 5"
%
curType
)
tdSql
.
query
(
"select * from st%s where id > 5"
%
curType
)
...
@@ -135,16 +143,22 @@ class TDTestCase:
...
@@ -135,16 +143,22 @@ class TDTestCase:
# range for int type on tag
# range for int type on tag
tdSql
.
query
(
"select * from st%s where id > 5 and id < 7"
%
curType
)
tdSql
.
query
(
"select * from st%s where id > 5 and id < 7"
%
curType
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select * from st%s where id >= 5 and id < 7"
%
curType
)
tdSql
.
query
(
tdSql
.
checkRows
(
20
)
"select * from st%s where id >= 5 and id < 7"
%
curType
)
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
"select * from st%s where id > 5 and id <= 7"
%
curType
)
tdSql
.
query
(
tdSql
.
checkRows
(
20
)
"select * from st%s where id > 5 and id <= 7"
%
curType
)
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
"select * from st%s where id >= 5 and id <= 7"
%
curType
)
tdSql
.
query
(
tdSql
.
checkRows
(
30
)
"select * from st%s where id >= 5 and id <= 7"
%
curType
)
tdSql
.
checkRows
(
30
)
print
(
print
(
"======= Verify filter for %s type finished ========="
%
"======= Verify filter for %s type finished ========="
%
...
...
tests/pytest/query/queryJoin.py
浏览文件 @
7c667191
...
@@ -77,7 +77,7 @@ class TDTestCase:
...
@@ -77,7 +77,7 @@ class TDTestCase:
# join queries
# join queries
tdSql
.
query
(
tdSql
.
query
(
"select * from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id"
)
"select * from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id"
)
tdSql
.
checkRows
(
6
)
tdSql
.
checkRows
(
6
)
tdSql
.
error
(
tdSql
.
error
(
"select ts, pressure, temperature, id, dscrption from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id"
)
"select ts, pressure, temperature, id, dscrption from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id"
)
...
@@ -108,7 +108,7 @@ class TDTestCase:
...
@@ -108,7 +108,7 @@ class TDTestCase:
tdSql
.
query
(
"select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id"
)
tdSql
.
query
(
"select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id"
)
tdSql
.
checkRows
(
6
)
tdSql
.
checkRows
(
6
)
tdSql
.
query
(
"select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id"
)
tdSql
.
query
(
"select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id"
)
tdSql
.
checkRows
(
6
)
tdSql
.
checkRows
(
6
)
...
...
tests/pytest/query/queryMetaData.py
浏览文件 @
7c667191
...
@@ -55,9 +55,9 @@ class MetadataQuery:
...
@@ -55,9 +55,9 @@ class MetadataQuery:
def
createTablesAndInsertData
(
self
,
threadID
):
def
createTablesAndInsertData
(
self
,
threadID
):
cursor
=
self
.
connectDB
()
cursor
=
self
.
connectDB
()
cursor
.
execute
(
"use test"
)
cursor
.
execute
(
"use test"
)
tablesPerThread
=
int
(
self
.
tables
/
self
.
numOfTherads
)
tablesPerThread
=
int
(
self
.
tables
/
self
.
numOfTherads
)
base
=
threadID
*
tablesPerThread
base
=
threadID
*
tablesPerThread
for
i
in
range
(
tablesPerThread
):
for
i
in
range
(
tablesPerThread
):
cursor
.
execute
(
cursor
.
execute
(
...
@@ -68,24 +68,72 @@ class MetadataQuery:
...
@@ -68,24 +68,72 @@ class MetadataQuery:
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')'''
%
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')'''
%
(
base
+
i
+
1
,
(
base
+
i
+
1
,
(
base
+
i
)
%
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
100
,
(
base
+
i
)
%
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
10000
,
(
base
+
i
)
%
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
1000000
,
(
base
+
i
)
%
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
100000000
,
(
base
+
i
)
%
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
100
*
1.1
,
(
base
+
i
)
%
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
))
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
))
cursor
.
execute
(
cursor
.
execute
(
"insert into t%d values(%d, 1) (%d, 2) (%d, 3) (%d, 4) (%d, 5)"
%
"insert into t%d values(%d, 1) (%d, 2) (%d, 3) (%d, 4) (%d, 5)"
%
(
base
+
i
+
1
,
self
.
ts
+
1
,
self
.
ts
+
2
,
self
.
ts
+
3
,
self
.
ts
+
4
,
self
.
ts
+
5
))
(
base
+
i
+
1
,
self
.
ts
+
1
,
self
.
ts
+
2
,
self
.
ts
+
3
,
self
.
ts
+
4
,
self
.
ts
+
5
))
cursor
.
close
()
cursor
.
close
()
def
queryData
(
self
,
query
):
def
queryData
(
self
,
query
):
cursor
=
self
.
connectDB
()
cursor
=
self
.
connectDB
()
cursor
.
execute
(
"use test"
)
cursor
.
execute
(
"use test"
)
print
(
"================= query tag data ================="
)
print
(
"================= query tag data ================="
)
startTime
=
datetime
.
now
()
startTime
=
datetime
.
now
()
cursor
.
execute
(
query
)
cursor
.
execute
(
query
)
cursor
.
fetchall
()
cursor
.
fetchall
()
...
@@ -107,15 +155,15 @@ if __name__ == '__main__':
...
@@ -107,15 +155,15 @@ if __name__ == '__main__':
print
(
print
(
"================= Create %d tables and insert %d records into each table ================="
%
"================= Create %d tables and insert %d records into each table ================="
%
(
t
.
tables
,
t
.
records
))
(
t
.
tables
,
t
.
records
))
startTime
=
datetime
.
now
()
startTime
=
datetime
.
now
()
threads
=
[]
threads
=
[]
for
i
in
range
(
t
.
numOfTherads
):
for
i
in
range
(
t
.
numOfTherads
):
thread
=
threading
.
Thread
(
thread
=
threading
.
Thread
(
target
=
t
.
createTablesAndInsertData
,
args
=
(
i
,))
target
=
t
.
createTablesAndInsertData
,
args
=
(
i
,))
thread
.
start
()
thread
.
start
()
threads
.
append
(
thread
)
threads
.
append
(
thread
)
for
th
in
threads
:
for
th
in
threads
:
th
.
join
()
th
.
join
()
endTime
=
datetime
.
now
()
endTime
=
datetime
.
now
()
...
...
tests/pytest/query/queryMetaPerformace.py
浏览文件 @
7c667191
...
@@ -19,6 +19,7 @@ import time
...
@@ -19,6 +19,7 @@ import time
from
datetime
import
datetime
from
datetime
import
datetime
import
numpy
as
np
import
numpy
as
np
class
MyThread
(
threading
.
Thread
):
class
MyThread
(
threading
.
Thread
):
def
__init__
(
self
,
func
,
args
=
()):
def
__init__
(
self
,
func
,
args
=
()):
...
@@ -35,17 +36,23 @@ class MyThread(threading.Thread):
...
@@ -35,17 +36,23 @@ class MyThread(threading.Thread):
except
Exception
:
except
Exception
:
return
None
return
None
class
MetadataQuery
:
class
MetadataQuery
:
def
initConnection
(
self
):
def
initConnection
(
self
):
self
.
tables
=
100
self
.
tables
=
100
self
.
records
=
10
self
.
records
=
10
self
.
numOfTherads
=
5
self
.
numOfTherads
=
5
self
.
ts
=
1537146000000
self
.
ts
=
1537146000000
self
.
host
=
"127.0.0.1"
self
.
host
=
"127.0.0.1"
self
.
user
=
"root"
self
.
user
=
"root"
self
.
password
=
"taosdata"
self
.
password
=
"taosdata"
self
.
config
=
"/etc/taos"
self
.
config
=
"/etc/taos"
self
.
conn
=
taos
.
connect
(
self
.
host
,
self
.
user
,
self
.
password
,
self
.
config
)
self
.
conn
=
taos
.
connect
(
self
.
host
,
self
.
user
,
self
.
password
,
self
.
config
)
def
connectDB
(
self
):
def
connectDB
(
self
):
return
self
.
conn
.
cursor
()
return
self
.
conn
.
cursor
()
...
@@ -69,7 +76,7 @@ class MetadataQuery:
...
@@ -69,7 +76,7 @@ class MetadataQuery:
cursor
.
execute
(
"use test"
)
cursor
.
execute
(
"use test"
)
base
=
threadID
*
self
.
tables
base
=
threadID
*
self
.
tables
tablesPerThread
=
int
(
self
.
tables
/
self
.
numOfTherads
)
tablesPerThread
=
int
(
self
.
tables
/
self
.
numOfTherads
)
for
i
in
range
(
tablesPerThread
):
for
i
in
range
(
tablesPerThread
):
cursor
.
execute
(
cursor
.
execute
(
'''create table t%d using meters tags(
'''create table t%d using meters tags(
...
@@ -79,20 +86,69 @@ class MetadataQuery:
...
@@ -79,20 +86,69 @@ class MetadataQuery:
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d',
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')'''
%
%d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')'''
%
(
base
+
i
+
1
,
(
base
+
i
+
1
,
(
base
+
i
)
%
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
100
,
(
base
+
i
)
%
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
10000
,
(
base
+
i
)
%
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
1000000
,
(
base
+
i
)
%
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
100000000
,
(
base
+
i
)
%
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
100
*
1.1
,
(
base
+
i
)
%
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
))
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
10000
,
(
base
+
i
)
%
1000000
,
(
base
+
i
)
%
100000000
,
(
base
+
i
)
%
100
*
1.1
,
(
base
+
i
)
%
100
*
2.3
,
(
base
+
i
)
%
2
,
(
base
+
i
)
%
100
,
(
base
+
i
)
%
100
))
for
j
in
range
(
self
.
records
):
for
j
in
range
(
self
.
records
):
cursor
.
execute
(
cursor
.
execute
(
"insert into t%d values(%d, %d)"
%
"insert into t%d values(%d, %d)"
%
(
base
+
i
+
1
,
self
.
ts
+
j
,
j
))
(
base
+
i
+
1
,
self
.
ts
+
j
,
j
))
cursor
.
close
()
cursor
.
close
()
def
queryWithTagId
(
self
,
threadId
,
tagId
,
queryNum
):
print
(
"---------thread%d start-----------"
%
threadId
)
def
queryWithTagId
(
self
,
threadId
,
tagId
,
queryNum
):
print
(
"---------thread%d start-----------"
%
threadId
)
query
=
'''select tgcol1, tgcol2, tgcol3, tgcol4, tgcol5, tgcol6, tgcol7, tgcol8, tgcol9,
query
=
'''select tgcol1, tgcol2, tgcol3, tgcol4, tgcol5, tgcol6, tgcol7, tgcol8, tgcol9,
tgcol10, tgcol11, tgcol12, tgcol13, tgcol14, tgcol15, tgcol16, tgcol17, tgcol18,
tgcol10, tgcol11, tgcol12, tgcol13, tgcol14, tgcol15, tgcol16, tgcol17, tgcol18,
tgcol19, tgcol20, tgcol21, tgcol22, tgcol23, tgcol24, tgcol25, tgcol26, tgcol27,
tgcol19, tgcol20, tgcol21, tgcol22, tgcol23, tgcol24, tgcol25, tgcol26, tgcol27,
...
@@ -103,18 +159,19 @@ class MetadataQuery:
...
@@ -103,18 +159,19 @@ class MetadataQuery:
latancy
=
[]
latancy
=
[]
cursor
=
self
.
connectDB
()
cursor
=
self
.
connectDB
()
cursor
.
execute
(
"use test"
)
cursor
.
execute
(
"use test"
)
for
i
in
range
(
queryNum
):
for
i
in
range
(
queryNum
):
startTime
=
time
.
time
()
startTime
=
time
.
time
()
cursor
.
execute
(
query
.
format
(
id
=
tagId
,
condition
=
i
))
cursor
.
execute
(
query
.
format
(
id
=
tagId
,
condition
=
i
))
cursor
.
fetchall
()
cursor
.
fetchall
()
latancy
.
append
((
time
.
time
()
-
startTime
))
latancy
.
append
((
time
.
time
()
-
startTime
))
print
(
"---------thread%d end-----------"
%
threadId
)
print
(
"---------thread%d end-----------"
%
threadId
)
return
latancy
return
latancy
def
queryData
(
self
,
query
):
def
queryData
(
self
,
query
):
cursor
=
self
.
connectDB
()
cursor
=
self
.
connectDB
()
cursor
.
execute
(
"use test"
)
cursor
.
execute
(
"use test"
)
print
(
"================= query tag data ================="
)
print
(
"================= query tag data ================="
)
startTime
=
datetime
.
now
()
startTime
=
datetime
.
now
()
cursor
.
execute
(
query
)
cursor
.
execute
(
query
)
cursor
.
fetchall
()
cursor
.
fetchall
()
...
@@ -124,7 +181,7 @@ class MetadataQuery:
...
@@ -124,7 +181,7 @@ class MetadataQuery:
(
endTime
-
startTime
).
seconds
)
(
endTime
-
startTime
).
seconds
)
cursor
.
close
()
cursor
.
close
()
#self.conn.close()
#
self.conn.close()
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
@@ -132,18 +189,33 @@ if __name__ == '__main__':
...
@@ -132,18 +189,33 @@ if __name__ == '__main__':
t
=
MetadataQuery
()
t
=
MetadataQuery
()
t
.
initConnection
()
t
.
initConnection
()
latancys
=
[]
latancys
=
[]
threads
=
[]
threads
=
[]
tagId
=
1
tagId
=
1
queryNum
=
1000
queryNum
=
1000
for
i
in
range
(
t
.
numOfTherads
):
for
i
in
range
(
t
.
numOfTherads
):
thread
=
MyThread
(
t
.
queryWithTagId
,
args
=
(
i
,
tagId
,
queryNum
))
thread
=
MyThread
(
t
.
queryWithTagId
,
args
=
(
i
,
tagId
,
queryNum
))
threads
.
append
(
thread
)
threads
.
append
(
thread
)
thread
.
start
()
thread
.
start
()
for
i
in
range
(
t
.
numOfTherads
):
for
i
in
range
(
t
.
numOfTherads
):
threads
[
i
].
join
()
threads
[
i
].
join
()
latancys
.
extend
(
threads
[
i
].
get_result
())
latancys
.
extend
(
threads
[
i
].
get_result
())
print
(
"Total query: %d"
%
(
queryNum
*
t
.
numOfTherads
))
print
(
"Total query: %d"
%
(
queryNum
*
t
.
numOfTherads
))
print
(
"statistic(s): mean= %f, P50 = %f, P75 = %f, P95 = %f, P99 = %f"
print
(
%
(
sum
(
latancys
)
/
(
queryNum
*
t
.
numOfTherads
),
np
.
percentile
(
latancys
,
50
),
np
.
percentile
(
latancys
,
75
),
np
.
percentile
(
latancys
,
95
),
np
.
percentile
(
latancys
,
99
)))
"statistic(s): mean= %f, P50 = %f, P75 = %f, P95 = %f, P99 = %f"
%
(
sum
(
latancys
)
/
(
queryNum
*
t
.
numOfTherads
),
np
.
percentile
(
latancys
,
50
),
np
.
percentile
(
latancys
,
75
),
np
.
percentile
(
latancys
,
95
),
np
.
percentile
(
latancys
,
99
)))
tests/pytest/query/select_last_crash.py
浏览文件 @
7c667191
...
@@ -23,7 +23,6 @@ class TDTestCase:
...
@@ -23,7 +23,6 @@ class TDTestCase:
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
tdSql
.
init
(
conn
.
cursor
())
self
.
rowNum
=
5000
self
.
rowNum
=
5000
self
.
ts
=
1537146000000
self
.
ts
=
1537146000000
...
@@ -36,7 +35,9 @@ class TDTestCase:
...
@@ -36,7 +35,9 @@ class TDTestCase:
"create table t1 using st tags('dev_001')"
)
"create table t1 using st tags('dev_001')"
)
for
i
in
range
(
self
.
rowNum
):
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into t1 values(%d, 'taosdata%d', %d)"
%
(
self
.
ts
+
i
,
i
+
1
,
i
+
1
))
tdSql
.
execute
(
"insert into t1 values(%d, 'taosdata%d', %d)"
%
(
self
.
ts
+
i
,
i
+
1
,
i
+
1
))
tdSql
.
query
(
"select last(*) from st"
)
tdSql
.
query
(
"select last(*) from st"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
...
...
tests/pytest/random-test/random-test-multi-threading-3.py
浏览文件 @
7c667191
...
@@ -330,7 +330,6 @@ class Test (Thread):
...
@@ -330,7 +330,6 @@ class Test (Thread):
self
.
q
.
put
(
-
1
)
self
.
q
.
put
(
-
1
)
tdLog
.
exit
(
"second thread failed, first thread exit too"
)
tdLog
.
exit
(
"second thread failed, first thread exit too"
)
elif
(
self
.
threadId
==
2
):
elif
(
self
.
threadId
==
2
):
while
True
:
while
True
:
self
.
dbEvent
.
wait
()
self
.
dbEvent
.
wait
()
...
...
tests/pytest/regressiontest.sh
浏览文件 @
7c667191
#!/bin/bash
#!/bin/bash
ulimit
-c
unlimited
ulimit
-c
unlimited
python3 ./test.py
-f
client/client.py
python3 ./test.py
-f
insert/basic.py
python3 ./test.py
-f
insert/basic.py
python3 ./test.py
-f
insert/int.py
python3 ./test.py
-f
insert/int.py
python3 ./test.py
-f
insert/float.py
python3 ./test.py
-f
insert/float.py
...
@@ -146,4 +145,5 @@ python3 ./test.py -f stream/stream2.py
...
@@ -146,4 +145,5 @@ python3 ./test.py -f stream/stream2.py
#alter table
#alter table
python3 ./test.py
-f
alter/alter_table_crash.py
python3 ./test.py
-f
alter/alter_table_crash.py
# client
python3 ./test.py
-f
client/client.py
tests/pytest/smoketest.sh
浏览文件 @
7c667191
#!/bin/bash
#!/bin/bash
ulimit
-c
unlimited
ulimit
-c
unlimited
# client
python3 ./test.py
$1
-f
client/client.py
python3 ./test.py
$1
-s
&&
sleep
1
# insert
# insert
python3 ./test.py
$1
-f
insert/basic.py
python3 ./test.py
$1
-f
insert/basic.py
python3 ./test.py
$1
-s
&&
sleep
1
python3 ./test.py
$1
-s
&&
sleep
1
...
@@ -35,3 +31,7 @@ python3 ./test.py $1 -s && sleep 1
...
@@ -35,3 +31,7 @@ python3 ./test.py $1 -s && sleep 1
python3 ./test.py
$1
-f
query/filter.py
python3 ./test.py
$1
-f
query/filter.py
python3 ./test.py
$1
-s
&&
sleep
1
python3 ./test.py
$1
-s
&&
sleep
1
# client
python3 ./test.py
$1
-f
client/client.py
python3 ./test.py
$1
-s
&&
sleep
1
tests/pytest/util/sql.py
浏览文件 @
7c667191
...
@@ -198,7 +198,7 @@ class TDSql:
...
@@ -198,7 +198,7 @@ class TDSql:
"%s failed: sql:%s, affectedRows:%d != expect:%d"
%
"%s failed: sql:%s, affectedRows:%d != expect:%d"
%
(
callerFilename
,
self
.
sql
,
self
.
affectedRows
,
expectAffectedRows
))
(
callerFilename
,
self
.
sql
,
self
.
affectedRows
,
expectAffectedRows
))
tdLog
.
info
(
"sql:%s, affectedRows:%d == expect:%d"
%
tdLog
.
info
(
"sql:%s, affectedRows:%d == expect:%d"
%
(
self
.
sql
,
self
.
affectedRows
,
expectAffectedRows
))
(
self
.
sql
,
self
.
affectedRows
,
expectAffectedRows
))
tdSql
=
TDSql
()
tdSql
=
TDSql
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录