Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
9fd351e5
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看板
提交
9fd351e5
编写于
9月 24, 2021
作者:
J
jiajingbin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
save
上级
66ee0326
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
56 addition
and
31 deletion
+56
-31
tests/pytest/insert/openTsdbJsonInsert.py
tests/pytest/insert/openTsdbJsonInsert.py
+56
-31
未找到文件。
tests/pytest/insert/openTsdbJsonInsert.py
浏览文件 @
9fd351e5
...
@@ -233,7 +233,7 @@ class TDTestCase:
...
@@ -233,7 +233,7 @@ class TDTestCase:
def
genFullTypeJson
(
self
,
ts_value
=
""
,
col_value
=
""
,
tag_value
=
""
,
stb_name
=
""
,
tb_name
=
""
,
def
genFullTypeJson
(
self
,
ts_value
=
""
,
col_value
=
""
,
tag_value
=
""
,
stb_name
=
""
,
tb_name
=
""
,
id_noexist_tag
=
None
,
id_change_tag
=
None
,
id_upper_tag
=
None
,
id_double_tag
=
None
,
id_noexist_tag
=
None
,
id_change_tag
=
None
,
id_upper_tag
=
None
,
id_double_tag
=
None
,
t_add_tag
=
None
,
t_mul_tag
=
None
,
c_multi_tag
=
None
,
c_blank_tag
=
None
,
t_blank_tag
=
None
,
t_add_tag
=
None
,
t_mul_tag
=
None
,
c_multi_tag
=
None
,
c_blank_tag
=
None
,
t_blank_tag
=
None
,
chinese_tag
=
None
,
multi_field_tag
=
None
):
chinese_tag
=
None
,
multi_field_tag
=
None
,
point_trans_tag
=
None
):
if
stb_name
==
""
:
if
stb_name
==
""
:
stb_name
=
tdCom
.
getLongName
(
len
=
6
,
mode
=
"letters"
)
stb_name
=
tdCom
.
getLongName
(
len
=
6
,
mode
=
"letters"
)
if
tb_name
==
""
:
if
tb_name
==
""
:
...
@@ -250,42 +250,44 @@ class TDTestCase:
...
@@ -250,42 +250,44 @@ class TDTestCase:
id
=
"id"
id
=
"id"
if
id_noexist_tag
is
None
:
if
id_noexist_tag
is
None
:
tag_value
[
id
]
=
tb_name
tag_value
[
id
]
=
tb_name
sql_json
=
{
"metric"
:
f
"
{
stb_name
}
"
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
sql_json
=
{
"metric"
:
stb_name
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
if
id_noexist_tag
is
not
None
:
if
id_noexist_tag
is
not
None
:
if
t_add_tag
is
not
None
:
if
t_add_tag
is
not
None
:
tag_value
[
"t9"
]
=
{
"value"
:
"ncharTagValue"
,
"type"
:
"nchar"
}
tag_value
[
"t9"
]
=
{
"value"
:
"ncharTagValue"
,
"type"
:
"nchar"
}
sql_json
=
{
"metric"
:
f
"
{
stb_name
}
"
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
sql_json
=
{
"metric"
:
stb_name
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
if
id_change_tag
is
not
None
:
if
id_change_tag
is
not
None
:
tag_value
.
pop
(
't8'
)
tag_value
.
pop
(
't8'
)
tag_value
[
"t8"
]
=
{
"value"
:
"ncharTagValue"
,
"type"
:
"nchar"
}
tag_value
[
"t8"
]
=
{
"value"
:
"ncharTagValue"
,
"type"
:
"nchar"
}
sql_json
=
{
"metric"
:
f
"
{
stb_name
}
"
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
sql_json
=
{
"metric"
:
stb_name
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
if
id_double_tag
is
not
None
:
if
id_double_tag
is
not
None
:
tag_value
[
"ID"
]
=
f
'"
{
tb_name
}
_2"'
tag_value
[
"ID"
]
=
f
'"
{
tb_name
}
_2"'
sql_json
=
{
"metric"
:
f
"
{
stb_name
}
"
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
sql_json
=
{
"metric"
:
stb_name
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
if
t_add_tag
is
not
None
:
if
t_add_tag
is
not
None
:
tag_value
[
"t10"
]
=
{
"value"
:
"ncharTagValue"
,
"type"
:
"nchar"
}
tag_value
[
"t10"
]
=
{
"value"
:
"ncharTagValue"
,
"type"
:
"nchar"
}
tag_value
[
"t11"
]
=
{
"value"
:
True
,
"type"
:
"bool"
}
tag_value
[
"t11"
]
=
{
"value"
:
True
,
"type"
:
"bool"
}
sql_json
=
{
"metric"
:
f
"
{
stb_name
}
"
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
sql_json
=
{
"metric"
:
stb_name
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
if
t_mul_tag
is
not
None
:
if
t_mul_tag
is
not
None
:
tag_value
.
pop
(
't8'
)
tag_value
.
pop
(
't8'
)
sql_json
=
{
"metric"
:
f
"
{
stb_name
}
"
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
sql_json
=
{
"metric"
:
stb_name
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
if
id_noexist_tag
is
not
None
:
if
id_noexist_tag
is
not
None
:
tag_value
.
pop
(
't8'
)
tag_value
.
pop
(
't8'
)
sql_json
=
{
"metric"
:
f
"
{
stb_name
}
"
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
sql_json
=
{
"metric"
:
stb_name
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
if
c_multi_tag
is
not
None
:
if
c_multi_tag
is
not
None
:
col_value
=
[{
"value"
:
True
,
"type"
:
"bool"
},
{
"value"
:
False
,
"type"
:
"bool"
}]
col_value
=
[{
"value"
:
True
,
"type"
:
"bool"
},
{
"value"
:
False
,
"type"
:
"bool"
}]
sql_json
=
{
"metric"
:
f
"
{
stb_name
}
"
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
sql_json
=
{
"metric"
:
stb_name
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
if
t_blank_tag
is
not
None
:
if
t_blank_tag
is
not
None
:
tag_value
=
{
"id"
:
f
'"
{
tdCom
.
getLongName
(
len
=
6
,
mode
=
"letters"
)
}
"'
}
tag_value
=
{
"id"
:
tdCom
.
getLongName
(
len
=
6
,
mode
=
"letters"
)
}
sql_json
=
{
"metric"
:
f
"
{
stb_name
}
"
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
sql_json
=
{
"metric"
:
stb_name
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
if
chinese_tag
is
not
None
:
if
chinese_tag
is
not
None
:
tag_value
=
{
"id"
:
"涛思数据"
,
"t0"
:
"涛思数据"
}
tag_value
=
{
"id"
:
"abc"
,
"t0"
:
{
"value"
:
"涛思数据"
,
"type"
:
"nchar"
}}
sql_json
=
{
"metric"
:
f
"
{
stb_name
}
"
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
col_value
=
{
"value"
:
"涛思数据"
,
"type"
:
"nchar"
}
sql_json
=
{
"metric"
:
stb_name
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
if
c_blank_tag
is
not
None
:
if
c_blank_tag
is
not
None
:
sql_json
.
pop
(
"value"
)
sql_json
.
pop
(
"value"
)
if
multi_field_tag
is
not
None
:
if
multi_field_tag
is
not
None
:
sql_json
=
{
"metric"
:
f
"
{
stb_name
}
"
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
,
"tags"
:
tag_value
}
sql_json
=
{
"metric"
:
stb_name
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
,
"tags2"
:
tag_value
}
if
point_trans_tag
is
not
None
:
sql_json
=
{
"metric"
:
"point.trans.test"
,
"timestamp"
:
ts_value
,
"value"
:
col_value
,
"tags"
:
tag_value
}
return
sql_json
,
stb_name
return
sql_json
,
stb_name
def
genMulTagColDict
(
self
,
genType
,
count
=
1
):
def
genMulTagColDict
(
self
,
genType
,
count
=
1
):
...
@@ -1125,21 +1127,43 @@ class TDTestCase:
...
@@ -1125,21 +1127,43 @@ class TDTestCase:
except
JsonPayloadError
as
err
:
except
JsonPayloadError
as
err
:
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
def
errorType
CheckCase
(
self
):
def
spell
CheckCase
(
self
):
stb_name
=
tdCom
.
getLongName
(
8
,
"letters"
)
stb_name
=
tdCom
.
getLongName
(
8
,
"letters"
)
input_sql_list
=
[
f
'
{
stb_name
}
0 "hkgjiwdj" t0=f t1=127I8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"'
,
\
input_json_list
=
[{
"metric"
:
f
'
{
stb_name
}
_1'
,
"timestamp"
:
{
"value"
:
1626006833639000000
,
"type"
:
"Ns"
},
"value"
:
{
"value"
:
1
,
"type"
:
"Bigint"
},
"tags"
:
{
"t1"
:
{
"value"
:
127
,
"type"
:
"tinYint"
}}},
f
'
{
stb_name
}
0 "hkgjiwdj" t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"'
,
\
{
"metric"
:
f
'
{
stb_name
}
_2'
,
"timestamp"
:
{
"value"
:
1626006833639000001
,
"type"
:
"nS"
},
"value"
:
{
"value"
:
32767
,
"type"
:
"smallInt"
},
"tags"
:
{
"t1"
:
{
"value"
:
32767
,
"type"
:
"smallYint"
}}},
f
'
{
stb_name
}
0 "hkgjiwdj" t0=f t1=127i8 t2=32767i16 t3=2147483647I32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"'
,
\
{
"metric"
:
f
'
{
stb_name
}
_3'
,
"timestamp"
:
{
"value"
:
1626006833639000002
,
"type"
:
"NS"
},
"value"
:
{
"value"
:
2147483647
,
"type"
:
"iNt"
},
"tags"
:
{
"t1"
:
{
"value"
:
2147483647
,
"type"
:
"iNt"
}}},
f
'
{
stb_name
}
0 "hkgjiwdj" t0=f t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807I64 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"'
,
\
{
"metric"
:
f
'
{
stb_name
}
_4'
,
"timestamp"
:
{
"value"
:
1626006833639000003
,
"type"
:
"Us"
},
"value"
:
{
"value"
:
9223372036854775807
,
"type"
:
"bigInt"
},
"tags"
:
{
"t1"
:
{
"value"
:
9223372036854775807
,
"type"
:
"bigInt"
}}},
f
'
{
stb_name
}
0 "hkgjiwdj" t0=f t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345F32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"'
,
\
{
"metric"
:
f
'
{
stb_name
}
_5'
,
"timestamp"
:
{
"value"
:
1626006833639000004
,
"type"
:
"uS"
},
"value"
:
{
"value"
:
11.12345
,
"type"
:
"flOat"
},
"tags"
:
{
"t1"
:
{
"value"
:
11.12345
,
"type"
:
"flOat"
}}},
f
'
{
stb_name
}
0 "hkgjiwdj" t0=f t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789F64 t7="vozamcts" t8=L"ncharTagValue"'
,
\
{
"metric"
:
f
'
{
stb_name
}
_6'
,
"timestamp"
:
{
"value"
:
1626006833639000005
,
"type"
:
"US"
},
"value"
:
{
"value"
:
22.123456789
,
"type"
:
"douBle"
},
"tags"
:
{
"t1"
:
{
"value"
:
22.123456789
,
"type"
:
"douBle"
}}},
f
'
{
stb_name
}
1626006833639000000NS "hkgjiwdj" t0=f t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"'
]
{
"metric"
:
f
'
{
stb_name
}
_7'
,
"timestamp"
:
{
"value"
:
1626006833639000006
,
"type"
:
"Ms"
},
"value"
:
{
"value"
:
"vozamcts"
,
"type"
:
"binaRy"
},
"tags"
:
{
"t1"
:
{
"value"
:
"vozamcts"
,
"type"
:
"binaRy"
}}},
for
input_json
in
input_sql_list
:
{
"metric"
:
f
'
{
stb_name
}
_8'
,
"timestamp"
:
{
"value"
:
1626006833639000007
,
"type"
:
"mS"
},
"value"
:
{
"value"
:
"vozamcts"
,
"type"
:
"nchAr"
},
"tags"
:
{
"t1"
:
{
"value"
:
"vozamcts"
,
"type"
:
"nchAr"
}}},
try
:
{
"metric"
:
f
'
{
stb_name
}
_9'
,
"timestamp"
:
{
"value"
:
1626006833639000008
,
"type"
:
"MS"
},
"value"
:
{
"value"
:
"vozamcts"
,
"type"
:
"nchAr"
},
"tags"
:
{
"t1"
:
{
"value"
:
"vozamcts"
,
"type"
:
"nchAr"
}}},
self
.
_conn
.
insert_json_payload
(
json
.
dumps
(
input_json
))
{
"metric"
:
f
'
{
stb_name
}
_10'
,
"timestamp"
:
{
"value"
:
1626006834
,
"type"
:
"S"
},
"value"
:
{
"value"
:
"vozamcts"
,
"type"
:
"nchAr"
},
"tags"
:
{
"t1"
:
{
"value"
:
"vozamcts"
,
"type"
:
"nchAr"
}}}]
raise
Exception
(
"should not reach here"
)
except
JsonPayloadError
as
err
:
for
input_sql
in
input_json_list
:
tdSql
.
checkNotEqual
(
err
.
errno
,
0
)
stb_name
=
input_sql
[
"metric"
]
self
.
resCmp
(
input_sql
,
stb_name
)
def
pointTransCheckCase
(
self
):
"""
metric value "." trans to "_"
"""
tdCom
.
cleanTb
()
input_json
=
self
.
genFullTypeJson
(
point_trans_tag
=
True
)[
0
]
stb_name
=
input_json
[
"metric"
].
replace
(
"."
,
"_"
)
print
(
input_json
)
self
.
resCmp
(
input_json
,
stb_name
)
def
defaultTypeCheckCase
(
self
):
stb_name
=
tdCom
.
getLongName
(
8
,
"letters"
)
input_sql_list
=
[
f
'
{
stb_name
}
_1 1626006833639000000Ns 9223372036854775807 t0=f t1=127 t2=32767i16 t3=2147483647i32 t4=9223372036854775807 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"'
,
\
f
'
{
stb_name
}
_2 1626006834S 22.123456789 t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789 t7="vozamcts" t8=L"ncharTagValue"'
,
\
f
'
{
stb_name
}
_3 1626006834S 10e5 t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=10e5 t7="vozamcts" t8=L"ncharTagValue"'
,
\
f
'
{
stb_name
}
_4 1626006834S 10.0e5 t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=10.0e5 t7="vozamcts" t8=L"ncharTagValue"'
,
\
f
'
{
stb_name
}
_5 1626006834S -10.0e5 t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=-10.0e5 t7="vozamcts" t8=L"ncharTagValue"'
]
for
input_sql
in
input_sql_list
:
stb_name
=
input_sql
.
split
(
" "
)[
0
]
self
.
resCmp
(
input_sql
,
stb_name
)
def
genSqlList
(
self
,
count
=
5
,
stb_name
=
""
,
tb_name
=
""
):
def
genSqlList
(
self
,
count
=
5
,
stb_name
=
""
,
tb_name
=
""
):
"""
"""
...
@@ -1451,12 +1475,13 @@ class TDTestCase:
...
@@ -1451,12 +1475,13 @@ class TDTestCase:
# self.multiInsertCheckCase(1000)
# self.multiInsertCheckCase(1000)
# self.batchErrorInsertCheckCase()
# self.batchErrorInsertCheckCase()
# self.multiColsInsertCheckCase()
# self.multiColsInsertCheckCase()
# TODO begin here
# self.blankColInsertCheckCase()
# self.blankColInsertCheckCase()
# self.blankTagInsertCheckCase()
# self.blankTagInsertCheckCase()
# self.chineseCheckCase()
# self.chineseCheckCase()
# self.multiFieldCheckCase()
# self.multiFieldCheckCase()
# self.errorTypeCheckCase()
#! bug
# self.spellCheckCase()
self
.
pointTransCheckCase
()
# # # MultiThreads
# # # MultiThreads
# self.stbInsertMultiThreadCheckCase()
# self.stbInsertMultiThreadCheckCase()
# self.sStbStbDdataInsertMultiThreadCheckCase()
# self.sStbStbDdataInsertMultiThreadCheckCase()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录