Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
哥们要飞
TDengine
提交
679d3093
T
TDengine
项目概览
哥们要飞
/
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,发现更多精彩内容 >>
提交
679d3093
编写于
11月 30, 2020
作者:
L
liuyq-617
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
<test> fix test case error
上级
1f8c70d4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
91 addition
and
15 deletion
+91
-15
Jenkinsfile
Jenkinsfile
+8
-0
tests/pytest/insert/restfulInsert.py
tests/pytest/insert/restfulInsert.py
+77
-9
tests/pytest/query/bug2218.py
tests/pytest/query/bug2218.py
+6
-6
未找到文件。
Jenkinsfile
浏览文件 @
679d3093
...
...
@@ -14,10 +14,12 @@ pipeline {
sh
'''
date
cd ${WKC}
git reset --hard
git checkout develop
git pull
git submodule update
cd ${WK}
git reset --hard
git checkout develop
git pull
export TZ=Asia/Harbin
...
...
@@ -39,11 +41,13 @@ pipeline {
steps
{
sh
'''
cd ${WKC}
git reset --hard
git checkout develop
git pull
git submodule update
cd ${WK}
git reset --hard
git checkout develop
git pull
export TZ=Asia/Harbin
...
...
@@ -65,11 +69,13 @@ pipeline {
steps
{
sh
'''
cd ${WKC}
git reset --hard
git checkout develop
git pull
git submodule update
cd ${WK}
git reset --hard
git checkout develop
git pull
export TZ=Asia/Harbin
...
...
@@ -108,11 +114,13 @@ pipeline {
steps
{
sh
'''
cd ${WKC}
git reset --hard
git checkout develop
git pull
git submodule update
cd ${WK}
git reset --hard
git checkout develop
git pull
export TZ=Asia/Harbin
...
...
tests/pytest/insert/restfulInsert.py
浏览文件 @
679d3093
...
...
@@ -18,7 +18,7 @@ import time
import
argparse
class
RestfulInsert
:
def
__init__
(
self
,
host
,
startTimestamp
,
dbname
,
threads
,
tables
,
records
,
batchSize
,
tbNamePerfix
,
outOfOrder
):
def
__init__
(
self
,
host
,
startTimestamp
,
dbname
,
threads
,
tables
,
records
,
batchSize
,
tbNamePerfix
,
outOfOrder
,
tablePerbatch
):
self
.
header
=
{
'Authorization'
:
'Basic cm9vdDp0YW9zZGF0YQ=='
}
self
.
url
=
"http://%s:6041/rest/sql"
%
host
self
.
ts
=
startTimestamp
...
...
@@ -29,12 +29,15 @@ class RestfulInsert:
self
.
batchSize
=
batchSize
self
.
tableNamePerfix
=
tbNamePerfix
self
.
outOfOrder
=
outOfOrder
self
.
tablePerbatch
=
tablePerbatch
def
createTable
(
self
,
threadID
):
tablesPerThread
=
int
(
self
.
numOfTables
/
self
.
numOfThreads
)
print
(
"create table %d to %d"
%
(
tablesPerThread
*
threadID
,
tablesPerThread
*
(
threadID
+
1
)
-
1
))
for
i
in
range
(
tablesPerThread
):
tablesPerThread
=
int
(
self
.
numOfTables
/
self
.
numOfThreads
)
loop
=
tablesPerThread
if
threadID
!=
self
.
numOfThreads
-
1
else
self
.
numOfTables
-
tablesPerThread
*
threadID
print
(
"create table %d to %d"
%
(
tablesPerThread
*
threadID
,
tablesPerThread
*
threadID
+
loop
-
1
))
for
i
in
range
(
loop
):
tableID
=
threadID
*
tablesPerThread
if
tableID
+
i
>=
self
.
numOfTables
:
break
name
=
'beijing'
if
tableID
%
2
==
0
else
'shanghai'
data
=
"create table if not exists %s.%s%d using %s.meters tags(%d, '%s')"
%
(
self
.
dbname
,
self
.
tableNamePerfix
,
tableID
+
i
,
self
.
dbname
,
tableID
+
i
,
name
)
response
=
requests
.
post
(
self
.
url
,
data
,
headers
=
self
.
header
)
...
...
@@ -55,6 +58,58 @@ class RestfulInsert:
response
=
requests
.
post
(
self
.
url
,
data
,
headers
=
self
.
header
)
if
response
.
status_code
!=
200
:
print
(
response
.
content
)
def
insertnData
(
self
,
threadID
):
print
(
"thread %d started"
%
threadID
)
tablesPerThread
=
int
(
self
.
numOfTables
/
self
.
numOfThreads
)
loop
=
int
(
self
.
recordsPerTable
/
self
.
batchSize
)
if
self
.
tablePerbatch
==
1
:
for
i
in
range
(
tablesPerThread
+
1
):
tableID
=
i
+
threadID
*
tablesPerThread
if
tableID
>=
self
.
numOfTables
:
return
start
=
self
.
ts
start1
=
time
.
time
()
for
k
in
range
(
loop
):
data
=
"insert into %s.%s%d values"
%
(
self
.
dbname
,
self
.
tableNamePerfix
,
tableID
)
values
=
[]
bloop
=
self
.
batchSize
if
k
!=
loop
-
1
else
self
.
recordsPerTable
-
self
.
batchSize
*
k
for
l
in
range
(
bloop
):
values
.
append
(
"(%d, %d, %d, %d)"
%
(
start
+
k
*
self
.
batchSize
+
l
,
random
.
randint
(
1
,
100
),
random
.
randint
(
1
,
100
),
random
.
randint
(
1
,
100
)))
if
len
(
data
)
>
1048576
:
print
(
'batch size is larger than 1M'
)
exit
(
-
1
)
if
self
.
outOfOrder
:
random
.
shuffle
(
values
)
data
+=
''
.
join
(
values
)
response
=
requests
.
post
(
self
.
url
,
data
,
headers
=
self
.
header
)
if
response
.
status_code
!=
200
:
print
(
response
.
content
)
print
(
'----------------'
,
loop
,
time
.
time
()
-
start1
)
else
:
for
i
in
range
(
0
,
tablesPerThread
+
self
.
tablePerbatch
,
self
.
tablePerbatch
):
for
k
in
range
(
loop
):
data
=
"insert into "
for
j
in
range
(
self
.
tablePerbatch
):
tableID
=
i
+
threadID
*
tablesPerThread
+
j
if
tableID
>=
self
.
numOfTables
:
return
start
=
self
.
ts
data
+=
"%s.%s%d values"
%
(
self
.
dbname
,
self
.
tableNamePerfix
,
tableID
)
values
=
[]
bloop
=
self
.
batchSize
if
k
!=
loop
-
1
else
self
.
recordsPerTable
-
self
.
batchSize
*
k
for
l
in
range
(
bloop
):
values
.
append
(
"(%d, %d, %d, %d)"
%
(
start
+
k
*
self
.
batchSize
+
l
,
random
.
randint
(
1
,
100
),
random
.
randint
(
1
,
100
),
random
.
randint
(
1
,
100
)))
if
self
.
outOfOrder
:
random
.
shuffle
(
values
)
data
+=
''
.
join
(
values
)
print
(
'------------------'
,
len
(
data
))
if
len
(
data
)
>
1024
*
1024
:
print
(
'batch size is larger than 1M'
)
exit
(
-
1
)
response
=
requests
.
post
(
self
.
url
,
data
,
headers
=
self
.
header
)
if
response
.
status_code
!=
200
:
print
(
response
.
content
)
def
insertUnlimitedData
(
self
,
threadID
):
print
(
"thread %d started"
%
threadID
)
...
...
@@ -85,7 +140,9 @@ class RestfulInsert:
if
response
.
status_code
!=
200
:
print
(
response
.
content
)
def
run
(
self
):
def
run
(
self
):
data
=
"drop database if exists %s"
%
self
.
dbname
requests
.
post
(
self
.
url
,
data
,
headers
=
self
.
header
)
data
=
"create database if not exists %s"
%
self
.
dbname
requests
.
post
(
self
.
url
,
data
,
headers
=
self
.
header
)
data
=
"create table if not exists %s.meters(ts timestamp, f1 int, f2 int, f3 int) tags(id int, loc nchar(20))"
%
self
.
dbname
...
...
@@ -135,14 +192,14 @@ parser.add_argument(
'-d'
,
'--db-name'
,
action
=
'store'
,
default
=
'test'
,
default
=
'test
1
'
,
type
=
str
,
help
=
'Database name to be created (default: test)'
)
parser
.
add_argument
(
'-t'
,
'--number-of-threads'
,
action
=
'store'
,
default
=
1
0
,
default
=
2
0
,
type
=
int
,
help
=
'Number of threads to create tables and insert datas (default: 10)'
)
parser
.
add_argument
(
...
...
@@ -156,7 +213,7 @@ parser.add_argument(
'-r'
,
'--number-of-records'
,
action
=
'store'
,
default
=
1000
,
default
=
1000
0
,
type
=
int
,
help
=
'Number of record to be created for each table (default: 1000, -1 for unlimited records)'
)
parser
.
add_argument
(
...
...
@@ -178,7 +235,18 @@ parser.add_argument(
'--out-of-order'
,
action
=
'store_true'
,
help
=
'The order of test data (default: False)'
)
parser
.
add_argument
(
'-b'
,
'--table-per-batch'
,
action
=
'store'
,
default
=
1
,
type
=
int
,
help
=
'the table per batch (default: 1)'
)
args
=
parser
.
parse_args
()
ri
=
RestfulInsert
(
args
.
host_name
,
args
.
start_timestamp
,
args
.
db_name
,
args
.
number_of_threads
,
args
.
number_of_tables
,
args
.
number_of_records
,
args
.
batch_size
,
args
.
table_name_prefix
,
args
.
out_of_order
)
ri
=
RestfulInsert
(
args
.
host_name
,
args
.
start_timestamp
,
args
.
db_name
,
args
.
number_of_threads
,
args
.
number_of_tables
,
args
.
number_of_records
,
args
.
batch_size
,
args
.
table_name_prefix
,
args
.
out_of_order
,
args
.
table_per_batch
)
ri
.
run
()
\ No newline at end of file
tests/pytest/query/bug2218.py
浏览文件 @
679d3093
...
...
@@ -38,12 +38,12 @@ class TDTestCase:
print
(
"test col*1*1 desc "
)
tdSql
.
query
(
'select c1,c1*1*1,c2*1*1,c3*1*1,c4*1*1,c5*1*1,c6*1*1 from mt0 order by ts desc limit 2'
)
tdSql
.
checkData
(
0
,
0
,
99
)
tdSql
.
checkData
(
0
,
1
,
0
.0
)
tdSql
.
checkData
(
0
,
2
,
0
.0
)
tdSql
.
checkData
(
0
,
3
,
0
.0
)
tdSql
.
checkData
(
0
,
4
,
0
.0
)
tdSql
.
checkData
(
0
,
5
,
0
.0
)
tdSql
.
checkData
(
0
,
6
,
0
.0
)
tdSql
.
checkData
(
0
,
1
,
99
.0
)
tdSql
.
checkData
(
0
,
2
,
499
.0
)
tdSql
.
checkData
(
0
,
3
,
99
.0
)
tdSql
.
checkData
(
0
,
4
,
99
.0
)
tdSql
.
checkData
(
0
,
5
,
99
.0
)
tdSql
.
checkData
(
0
,
6
,
999
.0
)
def
stop
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录