Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
8c62d84a
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
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看板
提交
8c62d84a
编写于
7月 23, 2021
作者:
W
wenzhouwww
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-5369]<test> add test case about taosdemo params 'time_step'
上级
c133eb1c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
324 addition
and
24 deletion
+324
-24
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+1
-0
tests/pytest/tools/taosdemoAllTest/taosdemoInsertMSDB.json
tests/pytest/tools/taosdemoAllTest/taosdemoInsertMSDB.json
+63
-0
tests/pytest/tools/taosdemoAllTest/taosdemoInsertNanoDB.json
tests/pytest/tools/taosdemoAllTest/taosdemoInsertNanoDB.json
+63
-0
tests/pytest/tools/taosdemoAllTest/taosdemoInsertUSDB.json
tests/pytest/tools/taosdemoAllTest/taosdemoInsertUSDB.json
+63
-0
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertTime_step.py
...test/tools/taosdemoAllTest/taosdemoTestInsertTime_step.py
+115
-0
tests/pytest/tools/taosdemoAllTest/taosdemoTestNanoCreateDB.sql
...pytest/tools/taosdemoAllTest/taosdemoTestNanoCreateDB.sql
+0
-7
tests/pytest/tools/taosdemoAllTest/taosdemoTestSupportNanoInsert.py
...st/tools/taosdemoAllTest/taosdemoTestSupportNanoInsert.py
+19
-17
未找到文件。
tests/pytest/fulltest.sh
浏览文件 @
8c62d84a
...
...
@@ -368,6 +368,7 @@ python3 test.py -f alter/alter_create_exception.py
python3 test.py
-f
tools/taosdemoAllTest/taosdemoTestSupportNanoInsert.py
python3 test.py
-f
tools/taosdemoAllTest/taosdemoTestSupportNanoQuery.py
python3 test.py
-f
tools/taosdemoAllTest/taosdemoTestSupportNanosubscribe.py
python3 test.py
-f
tools/taosdemoAllTest/taosdemoTestInsertTime_step.py
python3 ./test.py
-f
insert/flushwhiledrop.py
#======================p4-end===============
...
...
tests/pytest/tools/taosdemoAllTest/taosdemoInsertMSDB.json
0 → 100644
浏览文件 @
8c62d84a
{
"filetype"
:
"insert"
,
"cfgdir"
:
"/etc/taos"
,
"host"
:
"127.0.0.1"
,
"port"
:
6030
,
"user"
:
"root"
,
"password"
:
"taosdata"
,
"thread_count"
:
10
,
"thread_count_create_tbl"
:
10
,
"result_file"
:
"./insert_res.txt"
,
"confirm_parameter_prompt"
:
"no"
,
"insert_interval"
:
0
,
"interlace_rows"
:
100
,
"num_of_records_per_req"
:
1000
,
"max_sql_len"
:
1024000
,
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"testdb3"
,
"drop"
:
"yes"
,
"replica"
:
1
,
"days"
:
10
,
"cache"
:
50
,
"blocks"
:
8
,
"precision"
:
"ms"
,
"keep"
:
36
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
"walLevel"
:
1
,
"cachelast"
:
0
,
"quorum"
:
1
,
"fsync"
:
3000
,
"update"
:
0
},
"super_tables"
:
[{
"name"
:
"stb0"
,
"child_table_exists"
:
"no"
,
"childtable_count"
:
100
,
"childtable_prefix"
:
"tb0_"
,
"auto_create_table"
:
"no"
,
"batch_create_tbl_num"
:
20
,
"data_source"
:
"rand"
,
"insert_mode"
:
"taosc"
,
"insert_rows"
:
100
,
"childtable_offset"
:
0
,
"multi_thread_write_one_tbl"
:
"no"
,
"insert_interval"
:
0
,
"max_sql_len"
:
1024000
,
"disorder_ratio"
:
0
,
"disorder_range"
:
1000
,
"timestamp_step"
:
1000
,
"start_timestamp"
:
"2021-07-01 00:00:00.000"
,
"sample_format"
:
""
,
"sample_file"
:
""
,
"tags_file"
:
""
,
"columns"
:
[{
"type"
:
"INT"
},
{
"type"
:
"DOUBLE"
,
"count"
:
3
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
2
},
{
"type"
:
"BINARY"
,
"len"
:
32
,
"count"
:
2
},
{
"type"
:
"TIMESTAMP"
},
{
"type"
:
"BIGINT"
,
"count"
:
3
},{
"type"
:
"FLOAT"
,
"count"
:
1
},{
"type"
:
"SMALLINT"
,
"count"
:
1
},{
"type"
:
"TINYINT"
,
"count"
:
1
},
{
"type"
:
"BOOL"
},{
"type"
:
"NCHAR"
,
"len"
:
16
}],
"tags"
:
[{
"type"
:
"TINYINT"
,
"count"
:
2
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
5
},{
"type"
:
"NCHAR"
,
"len"
:
16
,
"count"
:
1
}]
}]
}]
}
tests/pytest/tools/taosdemoAllTest/taosdemoInsertNanoDB.json
0 → 100644
浏览文件 @
8c62d84a
{
"filetype"
:
"insert"
,
"cfgdir"
:
"/etc/taos"
,
"host"
:
"127.0.0.1"
,
"port"
:
6030
,
"user"
:
"root"
,
"password"
:
"taosdata"
,
"thread_count"
:
10
,
"thread_count_create_tbl"
:
10
,
"result_file"
:
"./insert_res.txt"
,
"confirm_parameter_prompt"
:
"no"
,
"insert_interval"
:
0
,
"interlace_rows"
:
100
,
"num_of_records_per_req"
:
1000
,
"max_sql_len"
:
1024000
,
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"testdb1"
,
"drop"
:
"yes"
,
"replica"
:
1
,
"days"
:
10
,
"cache"
:
50
,
"blocks"
:
8
,
"precision"
:
"ns"
,
"keep"
:
36
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
"walLevel"
:
1
,
"cachelast"
:
0
,
"quorum"
:
1
,
"fsync"
:
3000
,
"update"
:
0
},
"super_tables"
:
[{
"name"
:
"stb0"
,
"child_table_exists"
:
"no"
,
"childtable_count"
:
100
,
"childtable_prefix"
:
"tb0_"
,
"auto_create_table"
:
"no"
,
"batch_create_tbl_num"
:
20
,
"data_source"
:
"rand"
,
"insert_mode"
:
"taosc"
,
"insert_rows"
:
100
,
"childtable_offset"
:
0
,
"multi_thread_write_one_tbl"
:
"no"
,
"insert_interval"
:
0
,
"max_sql_len"
:
1024000
,
"disorder_ratio"
:
0
,
"disorder_range"
:
1000
,
"timestamp_step"
:
1000
,
"start_timestamp"
:
"2021-07-01 00:00:00.000"
,
"sample_format"
:
""
,
"sample_file"
:
""
,
"tags_file"
:
""
,
"columns"
:
[{
"type"
:
"INT"
},
{
"type"
:
"DOUBLE"
,
"count"
:
3
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
2
},
{
"type"
:
"BINARY"
,
"len"
:
32
,
"count"
:
2
},
{
"type"
:
"TIMESTAMP"
},
{
"type"
:
"BIGINT"
,
"count"
:
3
},{
"type"
:
"FLOAT"
,
"count"
:
1
},{
"type"
:
"SMALLINT"
,
"count"
:
1
},{
"type"
:
"TINYINT"
,
"count"
:
1
},
{
"type"
:
"BOOL"
},{
"type"
:
"NCHAR"
,
"len"
:
16
}],
"tags"
:
[{
"type"
:
"TINYINT"
,
"count"
:
2
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
5
},{
"type"
:
"NCHAR"
,
"len"
:
16
,
"count"
:
1
}]
}]
}]
}
tests/pytest/tools/taosdemoAllTest/taosdemoInsertUSDB.json
0 → 100644
浏览文件 @
8c62d84a
{
"filetype"
:
"insert"
,
"cfgdir"
:
"/etc/taos"
,
"host"
:
"127.0.0.1"
,
"port"
:
6030
,
"user"
:
"root"
,
"password"
:
"taosdata"
,
"thread_count"
:
10
,
"thread_count_create_tbl"
:
10
,
"result_file"
:
"./insert_res.txt"
,
"confirm_parameter_prompt"
:
"no"
,
"insert_interval"
:
0
,
"interlace_rows"
:
100
,
"num_of_records_per_req"
:
1000
,
"max_sql_len"
:
1024000
,
"databases"
:
[{
"dbinfo"
:
{
"name"
:
"testdb2"
,
"drop"
:
"yes"
,
"replica"
:
1
,
"days"
:
10
,
"cache"
:
50
,
"blocks"
:
8
,
"precision"
:
"us"
,
"keep"
:
36
,
"minRows"
:
100
,
"maxRows"
:
4096
,
"comp"
:
2
,
"walLevel"
:
1
,
"cachelast"
:
0
,
"quorum"
:
1
,
"fsync"
:
3000
,
"update"
:
0
},
"super_tables"
:
[{
"name"
:
"stb0"
,
"child_table_exists"
:
"no"
,
"childtable_count"
:
100
,
"childtable_prefix"
:
"tb0_"
,
"auto_create_table"
:
"no"
,
"batch_create_tbl_num"
:
20
,
"data_source"
:
"rand"
,
"insert_mode"
:
"taosc"
,
"insert_rows"
:
100
,
"childtable_offset"
:
0
,
"multi_thread_write_one_tbl"
:
"no"
,
"insert_interval"
:
0
,
"max_sql_len"
:
1024000
,
"disorder_ratio"
:
0
,
"disorder_range"
:
1000
,
"timestamp_step"
:
1000
,
"start_timestamp"
:
"2021-07-01 00:00:00.000"
,
"sample_format"
:
""
,
"sample_file"
:
""
,
"tags_file"
:
""
,
"columns"
:
[{
"type"
:
"INT"
},
{
"type"
:
"DOUBLE"
,
"count"
:
3
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
2
},
{
"type"
:
"BINARY"
,
"len"
:
32
,
"count"
:
2
},
{
"type"
:
"TIMESTAMP"
},
{
"type"
:
"BIGINT"
,
"count"
:
3
},{
"type"
:
"FLOAT"
,
"count"
:
1
},{
"type"
:
"SMALLINT"
,
"count"
:
1
},{
"type"
:
"TINYINT"
,
"count"
:
1
},
{
"type"
:
"BOOL"
},{
"type"
:
"NCHAR"
,
"len"
:
16
}],
"tags"
:
[{
"type"
:
"TINYINT"
,
"count"
:
2
},
{
"type"
:
"BINARY"
,
"len"
:
16
,
"count"
:
5
},{
"type"
:
"NCHAR"
,
"len"
:
16
,
"count"
:
1
}]
}]
}]
}
tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertTime_step.py
0 → 100644
浏览文件 @
8c62d84a
###################################################################
# 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
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
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
(
self
):
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/"
# insert: create one or mutiple tables per sql and insert multiple rows per sql
# check the params of taosdemo about time_step is nano
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/taosdemoInsertNanoDB.json -y "
%
binPath
)
tdSql
.
execute
(
"use testdb1"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
100
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"select count(*) from tb0_0"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
query
(
"describe stb0"
)
tdSql
.
getData
(
9
,
1
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
tdSql
.
query
(
"select last(ts) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
"2021-07-01 00:00:00.000099000"
)
# check the params of taosdemo about time_step is us
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/taosdemoInsertUSDB.json -y "
%
binPath
)
tdSql
.
execute
(
"use testdb2"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
100
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"select count(*) from tb0_0"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
query
(
"describe stb0"
)
tdSql
.
getData
(
9
,
1
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
tdSql
.
query
(
"select last(ts) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
"2021-07-01 00:00:00.099000"
)
# check the params of taosdemo about time_step is ms
os
.
system
(
"%staosdemo -f tools/taosdemoAllTest/taosdemoInsertMSDB.json -y "
%
binPath
)
tdSql
.
execute
(
"use testdb3"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkData
(
0
,
4
,
100
)
tdSql
.
query
(
"select count (tbname) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"select count(*) from tb0_0"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10000
)
tdSql
.
query
(
"describe stb0"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
tdSql
.
query
(
"select last(ts) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
"2021-07-01 00:01:39.000"
)
os
.
system
(
"rm -rf ./res.txt"
)
os
.
system
(
"rm -rf ./*.py.sql"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/tools/taosdemoAllTest/taosdemoTestNanoCreateDB.sql
已删除
100644 → 0
浏览文件 @
c133eb1c
drop
database
if
exists
nsdbsql
;
create
database
nsdbsql
precision
"ns"
keep
36
days
6
update
1
;
use
nsdbsql
;
CREATE
STABLE
meters
(
ts
timestamp
,
current
float
,
voltage
int
,
phase
float
)
TAGS
(
location
binary
(
64
),
groupdId
int
);
CREATE
TABLE
d1001
USING
meters
TAGS
(
"Beijing.Chaoyang"
,
2
);
INSERT
INTO
d1001
USING
METERS
TAGS
(
"Beijng.Chaoyang"
,
2
)
VALUES
(
now
,
10
.
2
,
219
,
0
.
32
);
INSERT
INTO
d1001
USING
METERS
TAGS
(
"Beijng.Chaoyang"
,
2
)
VALUES
(
now
,
85
,
32
,
0
.
76
);
tests/pytest/tools/taosdemoAllTest/taosdemoTestSupportNanoInsert.py
浏览文件 @
8c62d84a
...
...
@@ -64,8 +64,7 @@ class TDTestCase:
tdSql
.
query
(
"select count(*) from stb0"
)
tdSql
.
checkData
(
0
,
0
,
10000000
)
tdSql
.
query
(
"describe stb0"
)
tdSql
.
getData
(
8
,
1
)
tdSql
.
checkDataType
(
8
,
1
,
"TIMESTAMP"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
tdSql
.
query
(
"select last(ts) from stb0"
)
tdSql
.
getData
(
0
,
0
)
...
...
@@ -79,7 +78,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
10000000
)
# check c8 is an nano timestamp
tdSql
.
query
(
"describe stb1"
)
tdSql
.
checkDataType
(
8
,
1
,
"TIMESTAMP"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
# check insert timestamp_step is nano_second
tdSql
.
query
(
"select last(ts) from stb1"
)
tdSql
.
checkData
(
0
,
0
,
"2021-07-01 00:01:39.990000000"
)
...
...
@@ -99,7 +98,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
100000
)
# check c8 is an nano timestamp
tdSql
.
query
(
"describe stb0"
)
tdSql
.
checkDataType
(
8
,
1
,
"TIMESTAMP"
)
tdSql
.
checkDataType
(
9
,
1
,
"TIMESTAMP"
)
# insert by csv files and timetamp is long int , strings in ts and cols
...
...
@@ -118,16 +117,6 @@ class TDTestCase:
os
.
system
(
"rm -rf ./insert_res.txt"
)
os
.
system
(
"rm -rf tools/taosdemoAllTest/taosdemoTestSupportNano*.py.sql"
)
# taosdemo test insert with command and parameter , detals show taosdemo --help
os
.
system
(
"%staosdemo -u root -P taosdata -p 6030 -h vm84 -a 1 -m pre -n 10 -T 20 -t 60 -o res.txt -y "
%
binPath
)
...
...
@@ -140,13 +129,26 @@ class TDTestCase:
# check taosdemo -s
os
.
system
(
"%staosdemo -s tools/taosdemoAllTest/taosdemoTestNanoCreateDB.sql -y "
%
binPath
)
sqls_ls
=
[
'drop database if exists nsdbsql;'
,
'create database nsdbsql precision "ns" keep 36 days 6 update 1;'
,
'use nsdbsql;'
,
'CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupdId int);'
,
'CREATE TABLE d1001 USING meters TAGS ("Beijing.Chaoyang", 2);'
,
'INSERT INTO d1001 USING METERS TAGS ("Beijng.Chaoyang", 2) VALUES (now, 10.2, 219, 0.32);'
,
'INSERT INTO d1001 USING METERS TAGS ("Beijng.Chaoyang", 2) VALUES (now, 85, 32, 0.76);'
]
with
open
(
"./taosdemoTestNanoCreateDB.sql"
,
mode
=
"a"
)
as
sql_files
:
for
sql
in
sqls_ls
:
sql_files
.
write
(
sql
+
"
\n
"
)
sql_files
.
close
()
sleep
(
10
)
os
.
system
(
"%staosdemo -s taosdemoTestNanoCreateDB.sql -y "
%
binPath
)
tdSql
.
query
(
"select count(*) from nsdbsql.meters"
)
tdSql
.
checkData
(
0
,
0
,
2
)
os
.
system
(
"rm -rf ./res.txt"
)
os
.
system
(
"rm -rf ./*.py.sql"
)
os
.
system
(
"rm -rf ./taosdemoTestNanoCreateDB.sql"
)
def
stop
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录