Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4086b7bf
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
4086b7bf
编写于
1月 11, 2023
作者:
H
Hui Li
提交者:
GitHub
1月 11, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19494 from taosdata/test/TD-21886
test: refine query cases
上级
dfed4e76
07adf309
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
202 addition
and
14 deletion
+202
-14
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+5
-0
tests/system-test/2-query/nestedQuery.py
tests/system-test/2-query/nestedQuery.py
+6
-14
tests/system-test/2-query/out_of_order.py
tests/system-test/2-query/out_of_order.py
+191
-0
未找到文件。
tests/parallel_test/cases.task
浏览文件 @
4086b7bf
...
...
@@ -1039,6 +1039,11 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/insert_null_none.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/insert_null_none.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/insert_null_none.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/out_of_order.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/out_of_order.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/out_of_order.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/out_of_order.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/out_of_order.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-20582.py
...
...
tests/system-test/2-query/nestedQuery.py
浏览文件 @
4086b7bf
...
...
@@ -851,6 +851,7 @@ class TDTestCase:
tdLog
.
info
(
"========mark==%s==="
%
mark
);
try
:
tdSql
.
query
(
sql
,
queryTimes
=
1
)
self
.
explain_sql
(
sql
)
except
:
tdLog
.
info
(
"sql is not support :=====%s; "
%
sql
)
tdSql
.
error
(
sql
)
...
...
@@ -4995,9 +4996,7 @@ class TDTestCase:
sql
+=
"%s ;"
%
random
.
choice
(
self
.
limit_u_where
)
tdLog
.
info
(
sql
)
tdLog
.
info
(
len
(
sql
))
tdSql
.
query
(
sql
)
self
.
cur1
.
execute
(
sql
)
self
.
explain_sql
(
sql
)
self
.
data_check
(
sql
,
mark
=
'15-2'
)
tdSql
.
query
(
"select 15-2.2 from stable_1;"
)
for
i
in
range
(
self
.
fornum
):
...
...
@@ -5013,9 +5012,7 @@ class TDTestCase:
sql
+=
"%s ;"
%
random
.
choice
(
self
.
limit_u_where
)
tdLog
.
info
(
sql
)
tdLog
.
info
(
len
(
sql
))
tdSql
.
query
(
sql
)
self
.
cur1
.
execute
(
sql
)
self
.
explain_sql
(
sql
)
self
.
data_check
(
sql
,
mark
=
'15-2.2'
)
self
.
restartDnodes
()
tdSql
.
query
(
"select 15-3 from stable_1;"
)
...
...
@@ -5033,9 +5030,7 @@ class TDTestCase:
sql
+=
"%s "
%
random
.
choice
(
self
.
limit_where
)
tdLog
.
info
(
sql
)
tdLog
.
info
(
len
(
sql
))
tdSql
.
query
(
sql
)
self
.
cur1
.
execute
(
sql
)
self
.
explain_sql
(
sql
)
self
.
data_check
(
sql
,
mark
=
'15-3'
)
tdSql
.
query
(
"select 15-4 from stable_1;"
)
for
i
in
range
(
self
.
fornum
):
...
...
@@ -5052,9 +5047,7 @@ class TDTestCase:
sql
+=
"%s "
%
random
.
choice
(
self
.
limit_u_where
)
tdLog
.
info
(
sql
)
tdLog
.
info
(
len
(
sql
))
tdSql
.
query
(
sql
)
self
.
cur1
.
execute
(
sql
)
self
.
explain_sql
(
sql
)
self
.
data_check
(
sql
,
mark
=
'15-4'
)
tdSql
.
query
(
"select 15-4.2 from stable_1;"
)
for
i
in
range
(
self
.
fornum
):
...
...
@@ -5087,8 +5080,7 @@ class TDTestCase:
tdLog
.
info
(
sql
)
tdLog
.
info
(
len
(
sql
))
tdSql
.
query
(
sql
)
self
.
cur1
.
execute
(
sql
)
self
.
explain_sql
(
sql
)
self
.
data_check
(
sql
,
mark
=
'15-5'
)
#16 select * from (select calc_aggregate_regulars as agg from regular_table where <\>\in\and\or order by limit offset )
#self.dropandcreateDB_random("%s" %db, 1)
...
...
tests/system-test/2-query/out_of_order.py
0 → 100644
浏览文件 @
4086b7bf
###################################################################
# 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
random
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
,
replicaVar
):
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_benchmark
(
self
,
dbname
,
tables
,
per_table_num
,
order
,
replica
):
#O :Out of order
#A :Repliaca
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
os
.
system
(
"%staosBenchmark -d %s -t %d -n %d -O %d -a %d -b float,double,nchar\(200\),binary\(50\) -T 50 -y "
%
(
binPath
,
dbname
,
tables
,
per_table_num
,
order
,
replica
))
def
sql_base
(
self
,
dbname
):
self
.
check_sub
(
dbname
)
sql1
=
"select count(*) from %s.meters"
%
dbname
self
.
sql_base_check
(
sql1
,
sql1
)
self
.
check_sub
(
dbname
)
sql2
=
"select count(ts) from %s.meters"
%
dbname
self
.
sql_base_check
(
sql1
,
sql2
)
self
.
check_sub
(
dbname
)
sql2
=
"select count(_c0) from %s.meters"
%
dbname
self
.
sql_base_check
(
sql1
,
sql2
)
self
.
check_sub
(
dbname
)
sql2
=
"select count(c0) from %s.meters"
%
dbname
self
.
sql_base_check
(
sql1
,
sql2
)
self
.
check_sub
(
dbname
)
sql2
=
"select count(c1) from %s.meters"
%
dbname
self
.
sql_base_check
(
sql1
,
sql2
)
self
.
check_sub
(
dbname
)
sql2
=
"select count(c2) from %s.meters"
%
dbname
self
.
sql_base_check
(
sql1
,
sql2
)
self
.
check_sub
(
dbname
)
sql2
=
"select count(c3) from %s.meters"
%
dbname
self
.
sql_base_check
(
sql1
,
sql2
)
self
.
check_sub
(
dbname
)
sql2
=
"select count(t0) from %s.meters"
%
dbname
self
.
sql_base_check
(
sql1
,
sql2
)
self
.
check_sub
(
dbname
)
sql2
=
"select count(t1) from %s.meters"
%
dbname
self
.
sql_base_check
(
sql1
,
sql2
)
self
.
check_sub
(
dbname
)
sql2
=
"select count(ts) from (select * from %s.meters)"
%
dbname
self
.
sql_base_check
(
sql1
,
sql2
)
self
.
check_sub
(
dbname
)
sql2
=
"select count(_c0) from (select * from %s.meters)"
%
dbname
self
.
sql_base_check
(
sql1
,
sql2
)
self
.
check_sub
(
dbname
)
sql2
=
"select count(c0) from (select * from %s.meters)"
%
dbname
self
.
sql_base_check
(
sql1
,
sql2
)
self
.
check_sub
(
dbname
)
sql2
=
"select count(c1) from (select * from %s.meters)"
%
dbname
self
.
sql_base_check
(
sql1
,
sql2
)
self
.
check_sub
(
dbname
)
sql2
=
"select count(c2) from (select * from %s.meters)"
%
dbname
self
.
sql_base_check
(
sql1
,
sql2
)
self
.
check_sub
(
dbname
)
sql2
=
"select count(c3) from (select * from %s.meters)"
%
dbname
self
.
sql_base_check
(
sql1
,
sql2
)
self
.
check_sub
(
dbname
)
sql2
=
"select count(t0) from (select * from %s.meters)"
%
dbname
self
.
sql_base_check
(
sql1
,
sql2
)
self
.
check_sub
(
dbname
)
sql2
=
"select count(t1) from (select * from %s.meters)"
%
dbname
self
.
sql_base_check
(
sql1
,
sql2
)
def
sql_base_check
(
self
,
sql1
,
sql2
):
tdSql
.
query
(
sql1
)
sql1_result
=
tdSql
.
getData
(
0
,
0
)
tdLog
.
info
(
"sql:%s , result: %s"
%
(
sql1
,
sql1_result
))
tdSql
.
query
(
sql2
)
sql2_result
=
tdSql
.
getData
(
0
,
0
)
tdLog
.
info
(
"sql:%s , result: %s"
%
(
sql2
,
sql2_result
))
if
sql1_result
==
sql2_result
:
tdLog
.
info
(
f
"checkEqual success, sql1_result=
{
sql1_result
}
,sql2_result=
{
sql2_result
}
"
)
else
:
tdLog
.
exit
(
f
"checkEqual error, sql1_result==
{
sql1_result
}
,sql2_result=
{
sql2_result
}
"
)
def
run_sql
(
self
,
dbname
):
self
.
sql_base
(
dbname
)
tdSql
.
execute
(
" flush database %s;"
%
dbname
)
self
.
sql_base
(
dbname
)
def
check_sub
(
self
,
dbname
):
sql
=
"select count(*) from (select distinct(tbname) from %s.meters)"
%
dbname
tdSql
.
query
(
sql
)
num
=
tdSql
.
getData
(
0
,
0
)
for
i
in
range
(
0
,
num
):
sql1
=
"select count(*) from %s.d%d"
%
(
dbname
,
i
)
tdSql
.
query
(
sql1
)
sql1_result
=
tdSql
.
getData
(
0
,
0
)
tdLog
.
info
(
"sql:%s , result: %s"
%
(
sql1
,
sql1_result
))
def
check_out_of_order
(
self
,
dbname
,
tables
,
per_table_num
,
order
,
replica
):
self
.
run_benchmark
(
dbname
,
tables
,
per_table_num
,
order
,
replica
)
print
(
"sleep 10 seconds"
)
#time.sleep(10)
print
(
"sleep 10 seconds finish"
)
self
.
run_sql
(
dbname
)
def
run
(
self
):
startTime
=
time
.
time
()
#self.check_out_of_order('db1',10,random.randint(10000,50000),random.randint(1,10),1)
self
.
check_out_of_order
(
'db1'
,
random
.
randint
(
50
,
200
),
random
.
randint
(
10000
,
20000
),
random
.
randint
(
1
,
5
),
1
)
# self.check_out_of_order('db2',random.randint(50,200),random.randint(10000,50000),random.randint(5,50),1)
# self.check_out_of_order('db3',random.randint(50,200),random.randint(10000,50000),random.randint(50,100),1)
# self.check_out_of_order('db4',random.randint(50,200),random.randint(10000,50000),100,1)
endTime
=
time
.
time
()
print
(
"total time %ds"
%
(
endTime
-
startTime
))
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录