Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
冷面1992
TDengine
提交
8ef1606d
TDengine
项目概览
冷面1992
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8ef1606d
编写于
9月 15, 2021
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-6645/test]: Add some testcases.
上级
1949ceb6
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
139 addition
and
21 deletion
+139
-21
tests/examples/c/apitest.c
tests/examples/c/apitest.c
+8
-7
tests/pytest/insert/insertJSONPayload.py
tests/pytest/insert/insertJSONPayload.py
+119
-7
tests/pytest/insert/insertTelnetLines.py
tests/pytest/insert/insertTelnetLines.py
+12
-7
未找到文件。
tests/examples/c/apitest.c
浏览文件 @
8ef1606d
...
...
@@ -1090,9 +1090,10 @@ void verify_telnet_insert(TAOS* taos) {
//bigint
char
*
lines2_3
[]
=
{
"stb2_3 1626006833651ms -9223372036854775807i64 host=
\"
host0
\"
"
,
"stb2_3 1626006833652ms 9223372036854775807i64 host=
\"
host0
\"
"
"stb2_3 1626006833652ms 9223372036854775807i64 host=
\"
host0
\"
"
,
"stb2_3 1626006833662ms 9223372036854775807 host=
\"
host0
\"
"
};
code
=
taos_insert_telnet_lines
(
taos
,
lines2_3
,
2
);
code
=
taos_insert_telnet_lines
(
taos
,
lines2_3
,
3
);
if
(
code
)
{
printf
(
"lines2_3 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -1107,11 +1108,10 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_4 1626006833660ms -3.4e10f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833670ms 3.4E+2f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833680ms -3.4e-2f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833690ms 3.15 host=
\"
host0
\"
"
,
"stb2_4 1626006833700ms 3.4E38f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833710ms -3.4E38f32 host=
\"
host0
\"
"
};
code
=
taos_insert_telnet_lines
(
taos
,
lines2_4
,
1
1
);
code
=
taos_insert_telnet_lines
(
taos
,
lines2_4
,
1
0
);
if
(
code
)
{
printf
(
"lines2_4 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -1127,9 +1127,10 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_5 1626006833670ms 3.4E+2f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833680ms -3.4e-2f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833690ms 1.7E308f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833700ms -1.7E308f64 host=
\"
host0
\"
"
"stb2_5 1626006833700ms -1.7E308f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833710ms 3.15 host=
\"
host0
\"
"
};
code
=
taos_insert_telnet_lines
(
taos
,
lines2_5
,
1
0
);
code
=
taos_insert_telnet_lines
(
taos
,
lines2_5
,
1
1
);
if
(
code
)
{
printf
(
"lines2_5 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -1166,7 +1167,7 @@ void verify_telnet_insert(TAOS* taos) {
//nchar
char
*
lines2_8
[]
=
{
"stb2_8 1626006833610ms L
\"
nchar_val数值一
\"
host=
\"
host0
\"
"
,
"stb2_8 1626006833620ms L
\"
nchar_val数值二
\"
host=
\"
host0
\"
"
,
"stb2_8 1626006833620ms L
\"
nchar_val数值二
\"
host=
\"
host0
\"
"
};
code
=
taos_insert_telnet_lines
(
taos
,
lines2_8
,
2
);
if
(
code
)
{
...
...
tests/pytest/insert/insertJSONPayload.py
浏览文件 @
8ef1606d
...
...
@@ -31,6 +31,27 @@ class TDTestCase:
### Default format ###
### metric ###
print
(
"============= step0 : test metric ================"
)
payload
=
'''
{
"metric": ".stb.0.",
"timestamp": 1626006833610123,
"value": 10,
"tags": {
"t1": true,
"t2": false,
"t3": 10,
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_json_payload
(
payload
)
print
(
"insert_json_payload result {}"
.
format
(
code
))
tdSql
.
query
(
"describe _stb_0_"
)
tdSql
.
checkRows
(
6
)
### metric value ###
print
(
"============= step1 : test metric value types ================"
)
payload
=
'''
...
...
@@ -50,7 +71,7 @@ class TDTestCase:
print
(
"insert_json_payload result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb0_0"
)
tdSql
.
checkData
(
1
,
1
,
"
FLOA
T"
)
tdSql
.
checkData
(
1
,
1
,
"
BIGIN
T"
)
payload
=
'''
{
...
...
@@ -107,12 +128,52 @@ class TDTestCase:
print
(
"insert_json_payload result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb0_3"
)
tdSql
.
checkData
(
1
,
1
,
"
NCHAR
"
)
tdSql
.
checkData
(
1
,
1
,
"
BINARY
"
)
### timestamp 0 ###
payload
=
'''
{
"metric": "stb0_4",
"timestamp": 1626006833610123,
"value": 3.14,
"tags": {
"t1": true,
"t2": false,
"t3": 10,
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_json_payload
(
payload
)
print
(
"insert_json_payload result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb0_4"
)
tdSql
.
checkData
(
1
,
1
,
"DOUBLE"
)
payload
=
'''
{
"metric": "stb0_5",
"timestamp": 1626006833610123,
"value": 3.14E-2,
"tags": {
"t1": true,
"t2": false,
"t3": 10,
"t4": "123_abc_.!@#$%^&*:;,./?|+-=()[]{}<>"
}
}
'''
code
=
self
.
_conn
.
insert_json_payload
(
payload
)
print
(
"insert_json_payload result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb0_5"
)
tdSql
.
checkData
(
1
,
1
,
"DOUBLE"
)
print
(
"============= step2 : test timestamp ================"
)
### timestamp 0 ###
payload
=
'''
{
"metric": "stb0_6",
"timestamp": 0,
"value": 123,
"tags": {
...
...
@@ -127,14 +188,15 @@ class TDTestCase:
print
(
"insert_json_payload result {}"
.
format
(
code
))
print
(
"============= step3 : test tags ================"
)
### ID ###
payload
=
'''
{
"metric": "stb0_
5
",
"metric": "stb0_
7
",
"timestamp": 0,
"value": 123,
"tags": {
"ID": "tb0_
5
",
"ID": "tb0_
7
",
"t1": true,
"iD": "tb000",
"t2": false,
...
...
@@ -147,10 +209,60 @@ class TDTestCase:
code
=
self
.
_conn
.
insert_json_payload
(
payload
)
print
(
"insert_json_payload result {}"
.
format
(
code
))
tdSql
.
query
(
"select tbname from stb0_5"
)
tdSql
.
checkData
(
0
,
0
,
"tb0_5"
)
tdSql
.
query
(
"select tbname from stb0_7"
)
tdSql
.
checkData
(
0
,
0
,
"tb0_7"
)
### Default tag numeric types ###
payload
=
'''
{
"metric": "stb0_8",
"timestamp": 0,
"value": 123,
"tags": {
"t1": 123
}
}
'''
code
=
self
.
_conn
.
insert_json_payload
(
payload
)
print
(
"insert_json_payload result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb0_8"
)
tdSql
.
checkData
(
2
,
1
,
"BIGINT"
)
payload
=
'''
{
"metric": "stb0_9",
"timestamp": 0,
"value": 123,
"tags": {
"t1": 123.00
}
}
'''
code
=
self
.
_conn
.
insert_json_payload
(
payload
)
print
(
"insert_json_payload result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb0_9"
)
tdSql
.
checkData
(
2
,
1
,
"DOUBLE"
)
payload
=
'''
{
"metric": "stb0_10",
"timestamp": 0,
"value": 123,
"tags": {
"t1": 123E-1
}
}
'''
code
=
self
.
_conn
.
insert_json_payload
(
payload
)
print
(
"insert_json_payload result {}"
.
format
(
code
))
tdSql
.
query
(
"describe stb0_10"
)
tdSql
.
checkData
(
2
,
1
,
"DOUBLE"
)
### Nested format ###
print
(
"============= step4 : test nested format ================"
)
### timestamp ###
#seconds
payload
=
'''
...
...
tests/pytest/insert/insertTelnetLines.py
浏览文件 @
8ef1606d
...
...
@@ -36,13 +36,14 @@ class TDTestCase:
"stb0_0 1626006833639000000ns 4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
"stb0_1 1626006833639000000ns 4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
"stb0_2 1626006833639000000ns 4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
".stb0.3. 1626006833639000000ns 4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
]
code
=
self
.
_conn
.
insert_telnet_lines
(
lines0
)
print
(
"insert_telnet_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkRows
(
4
)
tdSql
.
query
(
"describe stb0_0"
)
tdSql
.
checkRows
(
4
)
...
...
@@ -53,6 +54,9 @@ class TDTestCase:
tdSql
.
query
(
"describe stb0_2"
)
tdSql
.
checkRows
(
4
)
tdSql
.
query
(
"describe _stb0_3_"
)
tdSql
.
checkRows
(
4
)
### timestamp ###
print
(
"============= step2 : test timestamp ================"
)
lines1
=
[
...
...
@@ -122,14 +126,15 @@ class TDTestCase:
#bigint
lines2_3
=
[
"stb2_3 1626006833651ms -9223372036854775807i64 host=
\"
host0
\"
"
,
"stb2_3 1626006833652ms 9223372036854775807i64 host=
\"
host0
\"
"
"stb2_3 1626006833652ms 9223372036854775807i64 host=
\"
host0
\"
"
,
"stb2_3 1626006833662ms 9223372036854775807 host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
insert_telnet_lines
(
lines2_3
)
print
(
"insert_telnet_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"select * from stb2_3"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"describe stb2_3"
)
tdSql
.
checkRows
(
3
)
...
...
@@ -145,7 +150,6 @@ class TDTestCase:
"stb2_4 1626006833660ms -3.4e10f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833670ms 3.4E+2f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833680ms -3.4e-2f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833690ms 3.15 host=
\"
host0
\"
"
,
"stb2_4 1626006833700ms 3.4E38f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833710ms -3.4E38f32 host=
\"
host0
\"
"
]
...
...
@@ -154,7 +158,7 @@ class TDTestCase:
print
(
"insert_telnet_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"select * from stb2_4"
)
tdSql
.
checkRows
(
1
1
)
tdSql
.
checkRows
(
1
0
)
tdSql
.
query
(
"describe stb2_4"
)
tdSql
.
checkRows
(
3
)
...
...
@@ -171,14 +175,15 @@ class TDTestCase:
"stb2_5 1626006833670ms 3.4E+2f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833680ms -3.4e-2f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833690ms 1.7E308f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833700ms -1.7E308f64 host=
\"
host0
\"
"
"stb2_5 1626006833700ms -1.7E308f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833710ms 3.15 host=
\"
host0
\"
"
]
code
=
self
.
_conn
.
insert_telnet_lines
(
lines2_5
)
print
(
"insert_telnet_lines result {}"
.
format
(
code
))
tdSql
.
query
(
"select * from stb2_5"
)
tdSql
.
checkRows
(
1
0
)
tdSql
.
checkRows
(
1
1
)
tdSql
.
query
(
"describe stb2_5"
)
tdSql
.
checkRows
(
3
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录