Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9e79aef9
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
9e79aef9
编写于
12月 01, 2020
作者:
H
huili
提交者:
GitHub
12月 01, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4386 from taosdata/test/testcase
Test/testcase
上级
5a0ee04b
ab6d41f7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
136 addition
and
12 deletion
+136
-12
Jenkinsfile
Jenkinsfile
+8
-0
tests/pytest/insert/restfulInsert.py
tests/pytest/insert/restfulInsert.py
+72
-6
tests/pytest/query/bug2117.py
tests/pytest/query/bug2117.py
+50
-0
tests/pytest/query/bug2218.py
tests/pytest/query/bug2218.py
+6
-6
未找到文件。
Jenkinsfile
浏览文件 @
9e79aef9
...
...
@@ -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
浏览文件 @
9e79aef9
...
...
@@ -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,7 @@ class RestfulInsert:
if
response
.
status_code
!=
200
:
print
(
response
.
content
)
def
run
(
self
):
def
run
(
self
):
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
...
...
@@ -178,7 +233,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/bug2117.py
0 → 100644
浏览文件 @
9e79aef9
###################################################################
# 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
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
run
(
self
):
tdSql
.
prepare
()
print
(
"==========step1"
)
print
(
"create table && insert data"
)
tdSql
.
execute
(
"create table mt0 (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool,c8 binary(20),c9 nchar(20))"
)
insertRows
=
1000
t0
=
1604298064000
tdLog
.
info
(
"insert %d rows"
%
(
insertRows
))
for
i
in
range
(
insertRows
):
ret
=
tdSql
.
execute
(
"insert into mt0 values (%d , %d,%d,%d,%d,%d,%d,%d,'%s','%s')"
%
(
t0
+
i
,
i
%
100
,
i
/
2
,
i
%
41
,
i
%
100
,
i
%
100
,
i
*
1.0
,
i
%
2
,
'taos'
+
str
(
i
%
100
),
'涛思'
+
str
(
i
%
100
)))
print
(
"==========step2"
)
print
(
"test last with group by normal_col "
)
tdSql
.
query
(
'select last(c1) from mt0 group by c3'
)
tdSql
.
checkData
(
0
,
0
,
84
)
tdSql
.
checkData
(
0
,
1
,
85
)
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/query/bug2218.py
浏览文件 @
9e79aef9
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录