Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7f5aaa25
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看板
提交
7f5aaa25
编写于
7月 26, 2021
作者:
J
jiajingbin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify some cases
上级
361e9f81
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
35 addition
and
30 deletion
+35
-30
tests/pytest/insert/schemalessInsert.py
tests/pytest/insert/schemalessInsert.py
+35
-30
未找到文件。
tests/pytest/insert/schemalessInsert.py
浏览文件 @
7f5aaa25
...
...
@@ -29,6 +29,15 @@ class TDTestCase:
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
_conn
=
conn
def
createDb
(
self
,
name
=
"test"
,
db_update_tag
=
0
):
if
db_update_tag
==
0
:
tdSql
.
execute
(
f
"drop database if exists
{
name
}
"
)
tdSql
.
execute
(
f
"create database if not exists
{
name
}
precision 'us'"
)
else
:
tdSql
.
execute
(
f
"drop database if exists
{
name
}
"
)
tdSql
.
execute
(
f
"create database if not exists
{
name
}
precision 'us' update 1"
)
tdSql
.
execute
(
f
'use
{
name
}
'
)
def
getLongName
(
self
,
len
,
mode
=
"mixed"
):
"""
generate long name
...
...
@@ -371,14 +380,13 @@ class TDTestCase:
"""
test ts list --> ["1626006833639000000ns", "1626006833639019us", "1626006833640ms", "1626006834s", "1626006822639022"]
# ! us级时间戳都为0时,数据库中查询显示,但python接口拿到的结果不显示 .000000的情况请确认,目前修改时间处理代码可以通过
# ! case bug
"""
self
.
cleanStb
()
ts_list
=
[
"1626006833639000000ns"
,
"1626006833639019us"
,
"1626006833640ms"
,
"1626006834s"
,
"1626006822639022"
,
0
]
for
ts
in
ts_list
:
print
(
ts
)
input_sql
,
stb_name
,
tb_name
=
self
.
genFullTypeSql
(
ts
=
ts
)
self
.
resCmp
(
input_sql
,
stb_name
,
ts
)
print
(
input_sql
)
self
.
resCmp
(
input_sql
,
stb_name
,
ts
=
ts
)
def
idSeqCheckCase
(
self
):
"""
...
...
@@ -428,24 +436,16 @@ class TDTestCase:
code
=
self
.
_conn
.
insertLines
([
input_sql
])
tdSql
.
checkNotEqual
(
code
,
0
)
# print("insertLines result {}".format(code))
# query_sql = f"describe {stb_name}"
# insert_tag_col_num = len(self.resHandle(query_sql, True)[0])
# expected_num = 128 + 1023 + 1
# tdSql.checkEqual(insert_tag_col_num, expected_num)
# input_sql, stb_name = self.genLongSql(128, 1500)
# code = self._conn.insertLines([input_sql])
# print(f'code---{code}')
def
idIllegalNameCheckCase
(
self
):
"""
test illegal id name
mix "`~!@#$¥%^&*()-+={}|[]、「」【】\:;《》<>?"
"""
self
.
cleanStb
()
rstr
=
list
(
"
!@#$%^&*()-+={}|[]\:
<>?"
)
rstr
=
list
(
"
`~!@#$¥%^&*()-+={}|[]、「」【】\:;《》
<>?"
)
for
i
in
rstr
:
input_sql
=
self
.
genFullTypeSql
(
tb_name
=
f
"
\"
aaa
{
i
}
bbb
\"
"
)[
0
]
print
(
input_sql
)
code
=
self
.
_conn
.
insertLines
([
input_sql
])
tdSql
.
checkNotEqual
(
code
,
0
)
...
...
@@ -710,8 +710,6 @@ class TDTestCase:
code
=
self
.
_conn
.
insertLines
([
input_sql_col
])
tdSql
.
checkNotEqual
(
code
,
0
)
##### stb exist #####
def
noIdStbExistCheckCase
(
self
):
"""
...
...
@@ -749,18 +747,28 @@ class TDTestCase:
self
.
resCmp
(
input_sql
,
stb_name
,
condition
=
f
'where tbname like "
{
tb_name
}
"'
)
# ! use tb_name
# ! need to improve 目前输出未校验
def
tagColAddDupIDCheckCase
(
self
):
"""
check column and tag count add, stb and tb duplicate
* tag: alter table ...
* col: when update==0 and ts is same, unchange
* so this case tag&&value will be added,
* col is added without value when update==0
* col is added with value when update==1
"""
self
.
cleanStb
()
for
db_update_tag
in
[
0
,
1
]:
if
db_update_tag
==
1
:
self
.
createDb
(
"test_update"
,
db_update_tag
=
db_update_tag
)
input_sql
,
stb_name
,
tb_name
=
self
.
genFullTypeSql
(
t0
=
"f"
,
c0
=
"f"
)
print
(
input_sql
)
self
.
resCmp
(
input_sql
,
stb_name
)
input_sql
,
stb_name
,
tb_name
=
self
.
genFullTypeSql
(
stb_name
=
stb_name
,
tb_name
=
f
'
{
tb_name
}
'
,
t0
=
"f"
,
c0
=
"f"
,
ct_add_tag
=
True
)
print
(
input_sql
)
# self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name}"')
if
db_update_tag
==
1
:
self
.
resCmp
(
input_sql
,
stb_name
,
condition
=
f
'where tbname like "
{
tb_name
}
"'
)
else
:
self
.
resCmp
(
input_sql
,
stb_name
,
condition
=
f
'where tbname like "
{
tb_name
}
"'
,
none_check_tag
=
True
)
def
tagColAddCheckCase
(
self
):
"""
...
...
@@ -1069,7 +1077,7 @@ class TDTestCase:
input_sql1
=
"rfasta,id=
\"
rfasta_1
\"
,t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=
\"
ddzhiksj
\"
,t8=L
\"
ncharTagValue
\"
c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=
\"
bnhwlgvj
\"
,c8=L
\"
ncharTagValue
\"
,c9=7u64 1626006833639000000ns"
input_sql2
=
"rfasta,t0=true,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=
\"
ddzhiksj
\"
,t8=L
\"
ncharTagValue
\"
c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=
\"
bnhwlgvj
\"
,c8=L
\"
ncharColValue
\"
,c9=7u64 1626006833639000000ns"
input_sql3
=
f
'abcd,id="cc
$
Ec",t0=True,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="ndsfdrum",t8=L"ncharTagValue" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="igwoehkm",c8=L"ncharColValue",c9=7u64 0'
input_sql3
=
f
'abcd,id="cc
¥
Ec",t0=True,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="ndsfdrum",t8=L"ncharTagValue" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="igwoehkm",c8=L"ncharColValue",c9=7u64 0'
print
(
input_sql3
)
# input_sql4 = 'hmemeb,id="kilrcrldgf",t0=F,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7="fysodjql",t8=L"ncharTagValue" c0=True,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7="waszbfvc",c8=L"ncharColValue",c9=7u64 0'
...
...
@@ -1080,9 +1088,7 @@ class TDTestCase:
def
run
(
self
):
print
(
"running {}"
.
format
(
__file__
))
tdSql
.
execute
(
"drop database if exists test"
)
tdSql
.
execute
(
"create database if not exists test precision 'us'"
)
tdSql
.
execute
(
'use test'
)
self
.
createDb
()
# tdSql.execute("create table super_table_cname_check (ts timestamp, pi1 int, pi2 bigint, pf1 float, pf2 double, ps1 binary(10), pi3 smallint, pi4 tinyint, pb1 bool, ps2 nchar(20)) tags (si1 int, si2 bigint, sf1 float, sf2 double, ss1 binary(10), si3 smallint, si4 tinyint, sb1 bool, ss2 nchar(20));")
...
...
@@ -1092,7 +1098,6 @@ class TDTestCase:
# self.initCheckCase()
# self.boolTypeCheckCase()
# self.symbolsCheckCase()
# ! case bug
# self.tsCheckCase()
# self.idSeqCheckCase()
# self.idUpperCheckCase()
...
...
@@ -1120,7 +1125,7 @@ class TDTestCase:
# self.tagColBinaryNcharLengthCheckCase()
# ! 结果未校验
#
self.tagColAddDupIDCheckCase()
self
.
tagColAddDupIDCheckCase
()
# self.tagColAddCheckCase()
# self.tagMd5Check()
...
...
@@ -1146,7 +1151,7 @@ class TDTestCase:
# ! concurrency conflict
# self.sStbStbDdataDtsInsertMultiThreadCheckCase()
self
.
test
()
#
self.test()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录