Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Tonvia
TDengine
提交
e8469ca5
T
TDengine
项目概览
Tonvia
/
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,发现更多精彩内容 >>
提交
e8469ca5
编写于
9月 06, 2021
作者:
L
liuyq-617
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-6221]<test>Perfect scene of concurrent inquery
上级
8081a7a5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
5 deletion
+26
-5
tests/pytest/concurrent_inquiry.py
tests/pytest/concurrent_inquiry.py
+26
-5
未找到文件。
tests/pytest/concurrent_inquiry.py
浏览文件 @
e8469ca5
...
...
@@ -23,7 +23,7 @@ import string
from
requests.auth
import
HTTPBasicAuth
func_list
=
[
'avg'
,
'count'
,
'twa'
,
'sum'
,
'stddev'
,
'leastsquares'
,
'min'
,
'max'
,
'first'
,
'last'
,
'top'
,
'bottom'
,
'percentile'
,
'apercentile'
,
'last_row'
,
'diff'
,
'spread'
]
'last_row'
,
'diff'
,
'spread'
,
'distinct'
]
condition_list
=
[
"where _c0 > now -10d "
,
'interval(10s)'
,
...
...
@@ -33,7 +33,7 @@ condition_list=[
'fill(null)'
]
where_list
=
[
'_c0>now-10d'
,
' <50'
,
'like'
,
' is null'
]
where_list
=
[
'_c0>now-10d'
,
' <50'
,
'like'
,
' is null'
,
'in'
]
class
ConcurrentInquiry
:
# def __init__(self,ts=1500000001000,host='127.0.0.1',user='root',password='taosdata',dbname='test',
# stb_prefix='st',subtb_prefix='t',n_Therads=10,r_Therads=10,probabilities=0.05,loop=5,
...
...
@@ -152,6 +152,20 @@ class ConcurrentInquiry:
elif
'is null'
in
c
:
conlist
=
' '
+
random
.
choice
(
tlist
)
+
random
.
choice
([
' is null'
,
' is not null'
])
l
.
append
(
conlist
)
elif
'in'
in
c
:
in_list
=
[]
temp
=
[]
for
i
in
range
(
random
.
randint
(
0
,
100
)):
temp
.
append
(
random
.
randint
(
-
10000
,
10000
))
temp
=
(
str
(
i
)
for
i
in
temp
)
in_list
.
append
(
temp
)
temp1
=
[]
for
i
in
range
(
random
.
randint
(
0
,
100
)):
temp1
.
append
(
"'"
+
''
.
join
(
random
.
sample
(
string
.
ascii_letters
,
random
.
randint
(
0
,
10
)))
+
"'"
)
in_list
.
append
(
temp1
)
in_list
.
append
([
'NULL'
,
'NULL'
])
conlist
=
' '
+
random
.
choice
(
tlist
)
+
' in ('
+
','
.
join
(
random
.
choice
(
in_list
))
+
')'
l
.
append
(
conlist
)
else
:
s_all
=
string
.
ascii_letters
conlist
=
' '
+
random
.
choice
(
tlist
)
+
" like
\'
%"
+
random
.
choice
(
s_all
)
+
"%
\'
"
...
...
@@ -182,7 +196,14 @@ class ConcurrentInquiry:
def
con_order
(
self
,
tlist
,
col_list
,
tag_list
):
return
'order by '
+
random
.
choice
(
tlist
)
def
con_state_window
(
self
,
tlist
,
col_list
,
tag_list
):
return
'state_window('
+
random
.
choice
(
tlist
+
tag_list
)
+
')'
def
con_session_window
(
self
,
tlist
,
col_list
,
tag_list
):
session_window
=
'session_window('
+
random
.
choice
(
tlist
+
tag_list
)
+
','
+
str
(
random
.
randint
(
0
,
20
))
+
random
.
choice
([
'a'
,
's'
,
'd'
,
'w'
,
'n'
,
'y'
])
+
')'
return
session_window
def
gen_subquery_sql
(
self
):
subsql
,
col_num
=
self
.
gen_query_sql
(
1
)
if
col_num
==
0
:
...
...
@@ -221,7 +242,7 @@ class ConcurrentInquiry:
else
:
sql
=
sql
+
','
.
join
(
sel_col_list
)
#select col & func
sql
=
sql
+
' from ('
+
subsql
+
') '
con_func
=
[
self
.
con_where
,
self
.
con_interval
,
self
.
con_limit
,
self
.
con_group
,
self
.
con_order
,
self
.
con_fill
]
con_func
=
[
self
.
con_where
,
self
.
con_interval
,
self
.
con_limit
,
self
.
con_group
,
self
.
con_order
,
self
.
con_fill
,
self
.
con_state_window
,
self
.
con_session_window
]
sel_con
=
random
.
sample
(
con_func
,
random
.
randint
(
0
,
len
(
con_func
)))
sel_con_list
=
[]
for
i
in
sel_con
:
...
...
@@ -281,7 +302,7 @@ class ConcurrentInquiry:
sql
=
sql
+
' from '
+
random
.
choice
(
self
.
subtb_list
)
+
' '
else
:
sql
=
sql
+
' from '
+
random
.
choice
(
self
.
stb_list
)
+
' '
con_func
=
[
self
.
con_where
,
self
.
con_interval
,
self
.
con_limit
,
self
.
con_group
,
self
.
con_order
,
self
.
con_fill
]
con_func
=
[
self
.
con_where
,
self
.
con_interval
,
self
.
con_limit
,
self
.
con_group
,
self
.
con_order
,
self
.
con_fill
,
self
.
con_state_window
,
self
.
con_session_window
]
sel_con
=
random
.
sample
(
con_func
,
random
.
randint
(
0
,
len
(
con_func
)))
sel_con_list
=
[]
for
i
in
sel_con
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录