Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d18dcb74
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
d18dcb74
编写于
11月 13, 2021
作者:
J
jiajingbin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
save
上级
59274448
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
36 addition
and
24 deletion
+36
-24
tests/pytest/insert/influxdbBlm3Insert.py
tests/pytest/insert/influxdbBlm3Insert.py
+12
-16
tests/pytest/util/common.py
tests/pytest/util/common.py
+16
-8
tests/pytest/util/sql.py
tests/pytest/util/sql.py
+8
-0
未找到文件。
tests/pytest/insert/influxdbBlm3Insert.py
浏览文件 @
d18dcb74
...
...
@@ -305,10 +305,8 @@ class TDTestCase:
expect_list
=
self
.
inputHandle
(
input_sql
,
ts_type
)
if
precision
==
None
:
res
=
tdCom
.
schemalessApiPost
(
sql
=
input_sql
,
precision
=
ts_type
)
# self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, ts_type)
else
:
res
=
tdCom
.
schemalessApiPost
(
sql
=
input_sql
,
precision
=
precision
)
# self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, precision)
query_sql
=
f
"
{
query_sql
}
{
stb_name
}
{
condition
}
"
res_row_list
,
res_field_list_without_ts
,
res_type_list
=
self
.
resHandle
(
query_sql
,
True
)
if
ts
==
0
:
...
...
@@ -338,9 +336,7 @@ class TDTestCase:
normal tags and cols, one for every elm
"""
tdLog
.
info
(
f
'
{
sys
.
_getframe
().
f_code
.
co_name
}
() function is running'
)
print
(
"???"
)
tdCom
.
cleanTb
(
type
=
"restful"
)
print
(
"???"
)
input_sql
,
stb_name
=
self
.
genFullTypeSql
()
self
.
resCmp
(
input_sql
,
stb_name
)
...
...
@@ -417,7 +413,7 @@ class TDTestCase:
tdSql
.
checkEqual
(
str
(
res
[
0
][
0
]),
"1626006833639000000"
)
tdSql
.
checkEqual
(
str
(
res
[
1
][
0
]),
"1626006833639000001"
)
tdCom
.
createDb
()
tdCom
.
createDb
(
api_type
=
"restful"
)
def
zeroTsCheckCase
(
self
):
tdLog
.
info
(
f
'
{
sys
.
_getframe
().
f_code
.
co_name
}
() function is running'
)
...
...
@@ -496,7 +492,7 @@ class TDTestCase:
res
=
tdSql
.
query
(
f
'select * from
{
stb_name
}
'
,
True
)
tdSql
.
checkEqual
(
str
(
res
[
0
][
0
]),
"2021-07-11 20:50:33.639000"
)
tdCom
.
createDb
()
tdCom
.
createDb
(
api_type
=
"restful"
)
def
iuCheckCase
(
self
):
tdLog
.
info
(
f
'
{
sys
.
_getframe
().
f_code
.
co_name
}
() function is running'
)
...
...
@@ -878,7 +874,7 @@ class TDTestCase:
tb_name
=
tdCom
.
getLongName
(
7
,
"letters"
)
for
db_update_tag
in
[
0
,
1
]:
if
db_update_tag
==
1
:
tdCom
.
createDb
(
"test_update"
,
db_update_tag
=
db_update_tag
)
tdCom
.
createDb
(
"test_update"
,
db_update_tag
=
db_update_tag
,
api_type
=
"restful"
)
input_sql
,
stb_name
=
self
.
genFullTypeSql
(
tb_name
=
tb_name
,
t0
=
"t"
,
c0
=
"t"
)
self
.
resCmp
(
input_sql
,
stb_name
)
input_sql
,
stb_name
=
self
.
genFullTypeSql
(
stb_name
=
stb_name
,
tb_name
=
tb_name
,
t0
=
"t"
,
c0
=
"f"
,
ct_add_tag
=
True
)
...
...
@@ -897,7 +893,7 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
12
,
None
)
tdSql
.
checkData
(
0
,
22
,
None
)
tdSql
.
checkData
(
0
,
23
,
None
)
tdCom
.
createDb
()
tdCom
.
createDb
(
api_type
=
"restful"
)
@
tdCom
.
smlPass
def
tagColAddCheckCase
(
self
):
...
...
@@ -974,7 +970,6 @@ class TDTestCase:
tdLog
.
info
(
f
'
{
sys
.
_getframe
().
f_code
.
co_name
}
() function is running'
)
tdCom
.
cleanTb
(
type
=
"restful"
)
stb_name
=
tdCom
.
getLongName
(
7
,
"letters"
)
tb_name
=
f
'
{
stb_name
}
_1'
input_sql
=
f
'
{
stb_name
}
,t2=
{
tdCom
.
getLongName
(
1
,
"letters"
)
}
c0=f 1626006833639000000'
tdCom
.
schemalessApiPost
(
sql
=
input_sql
,
precision
=
"ns"
)
...
...
@@ -993,7 +988,7 @@ class TDTestCase:
tdSql
.
checkRows
(
2
)
input_sql
=
f
'
{
stb_name
}
,t2=
{
tdCom
.
getLongName
(
1
,
"letters"
)
}
c0=f,c1=L"
{
tdCom
.
getLongName
(
4093
,
"letters"
)
}
",c2=L"
{
tdCom
.
getLongName
(
4093
,
"letters"
)
}
",c3=L"
{
tdCom
.
getLongName
(
4093
,
"letters"
)
}
",c4=L"
{
tdCom
.
getLongName
(
4
,
"letters"
)
}
" 1626006833639000000'
tdCom
.
schemalessApiPost
(
sql
=
input_sql
,
precision
=
"ns"
)
res
=
tdCom
.
schemalessApiPost
(
sql
=
input_sql
,
precision
=
"ns"
)
tdSql
.
query
(
f
"select * from
{
stb_name
}
"
)
tdSql
.
checkRows
(
3
)
input_sql
=
f
'
{
stb_name
}
,t2=
{
tdCom
.
getLongName
(
1
,
"letters"
)
}
c0=f,c1=L"
{
tdCom
.
getLongName
(
4093
,
"letters"
)
}
",c2=L"
{
tdCom
.
getLongName
(
4093
,
"letters"
)
}
",c3=L"
{
tdCom
.
getLongName
(
4093
,
"letters"
)
}
",c4=L"
{
tdCom
.
getLongName
(
5
,
"letters"
)
}
" 1626006833639000000'
...
...
@@ -1011,7 +1006,7 @@ class TDTestCase:
tdLog
.
info
(
f
'
{
sys
.
_getframe
().
f_code
.
co_name
}
() function is running'
)
tdCom
.
cleanTb
(
type
=
"restful"
)
stb_name
=
tdCom
.
getLongName
(
8
,
"letters"
)
td
Sql
.
execute
(
f
'create stable
{
stb_name
}
(ts timestamp, f int) tags(t1 bigint)'
)
td
Com
.
restApiPost
(
f
'create stable
{
stb_name
}
(ts timestamp, f int) tags(t1 bigint)'
)
lines
=
f
'st123456,t1=3i64,t2=4f64,t3=
\"
t3
\"
c1=3i64,c3=L
\"
passit
\"
,c2=false,c4=4f64 1626006833639000000
\n\
st123456,t1=4i64,t3=
\"
t4
\"
,t2=5f64,t4=5f64 c1=3i64,c3=L
\"
passitagin
\"
,c2=true,c4=5f64,c5=5f64 1626006833640000000
\n\
{
stb_name
}
,t2=5f64,t3=L
\"
ste
\"
c1=true,c2=4i64,c3=
\"
iam
\"
1626056811823316532
\n\
...
...
@@ -1162,7 +1157,7 @@ st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=f
tdSql
.
checkEqual
(
query_res
,
[(
datetime
.
datetime
(
2021
,
7
,
11
,
20
,
35
,
33
,
640000
),
True
,
127
,
32767
,
2147483647
,
9223372036854775807
,
11.12345027923584
,
22.123456789
,
'bnhwlgvj'
,
'ncharTagValue'
,
7
,
'true'
,
'127i8'
,
'32767i16'
,
'2147483647i32'
,
'9223372036854775807i64'
,
'11.12345f32'
,
'22.123456789f64'
,
'"ddzhiksj"'
,
'L"ncharTagValue"'
)])
col_tag_res
=
tdSql
.
getColNameList
(
query_sql
)
tdSql
.
checkEqual
(
col_tag_res
,
[
'_ts'
,
'c)0'
,
'c{1'
,
'c[2'
,
'c;3'
,
'c:4'
,
'c<5'
,
'c>6'
,
'c?7'
,
'c.8'
,
'c!@#$%^&*()_+[];:<>?,'
,
'tt!0'
,
'tt@1'
,
't#2'
,
'"t$3"'
,
't%4'
,
't^5'
,
't&6'
,
't*7'
,
't!@#$%^&*()_+[];:<>?,9'
])
td
Sql
.
execute
(
'drop table `rfa$sta`'
)
td
Com
.
restApiPost
(
'drop table `rfa$sta`'
)
def
genSqlList
(
self
,
count
=
5
,
stb_name
=
""
,
tb_name
=
""
):
"""
...
...
@@ -1248,8 +1243,8 @@ st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=f
tdSql
.
query
(
f
"show tables;"
)
tdSql
.
checkRows
(
1
)
if
self
.
smlChildTableName_value
==
"ID"
else
tdSql
.
checkRows
(
6
)
expected_tb_name
=
self
.
getNoIdTbName
(
stb_name
)[
0
]
if
self
.
smlChildTableName_value
==
"ID"
:
expected_tb_name
=
self
.
getNoIdTbName
(
stb_name
)[
0
]
tdSql
.
checkEqual
(
tb_name
,
expected_tb_name
)
tdSql
.
query
(
f
"select * from
{
stb_name
}
;"
)
tdSql
.
checkRows
(
1
)
if
self
.
smlChildTableName_value
==
"ID"
else
tdSql
.
checkRows
(
6
)
...
...
@@ -1267,8 +1262,8 @@ st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=f
self
.
multiThreadRun
(
self
.
genMultiThreadSeq
(
s_stb_s_tb_a_col_a_tag_list
))
tdSql
.
query
(
f
"show tables;"
)
tdSql
.
checkRows
(
1
)
if
self
.
smlChildTableName_value
==
"ID"
else
tdSql
.
checkRows
(
6
)
expected_tb_name
=
self
.
getNoIdTbName
(
stb_name
)[
0
]
if
self
.
smlChildTableName_value
==
"ID"
:
expected_tb_name
=
self
.
getNoIdTbName
(
stb_name
)[
0
]
tdSql
.
checkEqual
(
tb_name
,
expected_tb_name
)
tdSql
.
query
(
f
"select * from
{
stb_name
}
;"
)
tdSql
.
checkRows
(
1
)
if
self
.
smlChildTableName_value
==
"ID"
else
tdSql
.
checkRows
(
6
)
...
...
@@ -1286,8 +1281,8 @@ st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=f
self
.
multiThreadRun
(
self
.
genMultiThreadSeq
(
s_stb_s_tb_m_col_m_tag_list
))
tdSql
.
query
(
f
"show tables;"
)
tdSql
.
checkRows
(
1
)
if
self
.
smlChildTableName_value
==
"ID"
else
tdSql
.
checkRows
(
2
)
expected_tb_name
=
self
.
getNoIdTbName
(
stb_name
)[
0
]
if
self
.
smlChildTableName_value
==
"ID"
:
expected_tb_name
=
self
.
getNoIdTbName
(
stb_name
)[
0
]
tdSql
.
checkEqual
(
tb_name
,
expected_tb_name
)
tdSql
.
query
(
f
"select * from
{
stb_name
}
;"
)
tdSql
.
checkRows
(
1
)
if
self
.
smlChildTableName_value
==
"ID"
else
tdSql
.
checkRows
(
2
)
...
...
@@ -1509,8 +1504,9 @@ st123456,t1=4i64,t3=\"t4\",t2=5f64,t4=5f64 c1=3i64,c3=L\"passitagin_stf\",c2=f
def
run
(
self
):
print
(
"running {}"
.
format
(
__file__
))
tdCom
.
createDb
()
tdCom
.
createDb
(
api_type
=
"restful"
)
try
:
# self.tagColNcharMaxLengthCheckCase()
# self.initCheckCase()
# self.test()
self
.
runAll
()
...
...
tests/pytest/util/common.py
浏览文件 @
d18dcb74
...
...
@@ -33,7 +33,15 @@ class TDCom:
def
restApiPost
(
self
,
sql
):
requests
.
post
(
self
.
preDefine
()[
1
],
sql
.
encode
(
"utf-8"
),
headers
=
self
.
preDefine
()[
0
])
def
createDb
(
self
,
dbname
=
"test"
,
db_update_tag
=
0
):
def
createDb
(
self
,
dbname
=
"test"
,
db_update_tag
=
0
,
api_type
=
"taosc"
):
if
api_type
==
"taosc"
:
if
db_update_tag
==
0
:
tdSql
.
execute
(
f
"drop database if exists
{
dbname
}
"
)
tdSql
.
execute
(
f
"create database if not exists
{
dbname
}
precision 'us'"
)
else
:
tdSql
.
execute
(
f
"drop database if exists
{
dbname
}
"
)
tdSql
.
execute
(
f
"create database if not exists
{
dbname
}
precision 'us' update 1"
)
elif
api_type
==
"restful"
:
if
db_update_tag
==
0
:
self
.
restApiPost
(
f
"drop database if exists
{
dbname
}
"
)
self
.
restApiPost
(
f
"create database if not exists
{
dbname
}
precision 'us'"
)
...
...
@@ -58,7 +66,7 @@ class TDCom:
if
url_type
==
"influxdb"
:
url
=
self
.
genUrl
(
url_type
,
dbname
,
precision
)
elif
url_type
==
"telnet"
:
url
=
self
.
genUrl
(
url_type
,
dbname
)
url
=
self
.
genUrl
(
url_type
,
dbname
,
precision
)
res
=
requests
.
post
(
url
,
sql
.
encode
(
"utf-8"
),
headers
=
self
.
preDefine
()[
0
])
return
res
...
...
tests/pytest/util/sql.py
浏览文件 @
d18dcb74
...
...
@@ -332,6 +332,14 @@ class TDSql:
args
=
(
caller
.
filename
,
caller
.
lineno
,
self
.
sql
,
elm
,
expect_elm
)
tdLog
.
exit
(
"%s(%d) failed: sql:%s, elm:%s == expect_elm:%s"
%
args
)
def
checkIn
(
self
,
sub
,
res
):
if
sub
in
res
:
tdLog
.
info
(
"sql:%s, sub:%s in result:%s"
%
(
self
.
sql
,
sub
,
res
))
else
:
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
1
][
0
])
args
=
(
caller
.
filename
,
caller
.
lineno
,
self
.
sql
,
sub
,
res
)
tdLog
.
exit
(
"%s(%d) failed: sql:%s, sub:%s not in result:%s"
%
args
)
def
taosdStatus
(
self
,
state
):
tdLog
.
sleep
(
5
)
pstate
=
0
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录