Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
cda7463a
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
cda7463a
编写于
6月 09, 2022
作者:
J
jiacy-jcy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update test cases
上级
eeba1cdb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
121 addition
and
30 deletion
+121
-30
tests/system-test/1-insert/alter_stable.py
tests/system-test/1-insert/alter_stable.py
+3
-3
tests/system-test/1-insert/alter_table.py
tests/system-test/1-insert/alter_table.py
+100
-0
tests/system-test/2-query/To_iso8601.py
tests/system-test/2-query/To_iso8601.py
+18
-27
未找到文件。
tests/system-test/1-insert/alter_stable.py
浏览文件 @
cda7463a
...
...
@@ -122,10 +122,10 @@ class TDTestCase:
for
i
in
[
'bigint'
,
'unsigned int'
,
'float'
,
'double'
,
'binary(10)'
,
'nchar(10)'
]:
for
j
in
[
1
,
2
,
3
]:
tdSql
.
error
(
f
'alter table
{
stbname
}
modify tag t
{
j
}
{
i
}
'
)
tdSql
.
error
(
f
'alter
s
table
{
stbname
}
modify tag t
{
j
}
{
i
}
'
)
for
i
in
[
'int'
,
'unsigned int'
,
'float'
,
'binary(10)'
,
'nchar(10)'
]:
tdSql
.
error
(
f
'alter table
{
stbname
}
modify tag t8
{
i
}
'
)
tdSql
.
error
(
f
'alter table
{
stbname
}
modify tag t4 int'
)
tdSql
.
error
(
f
'alter
s
table
{
stbname
}
modify tag t8
{
i
}
'
)
tdSql
.
error
(
f
'alter
s
table
{
stbname
}
modify tag t4 int'
)
tdSql
.
execute
(
f
'drop database
{
dbname
}
'
)
def
run
(
self
):
...
...
tests/system-test/1-insert/alter_table.py
浏览文件 @
cda7463a
...
...
@@ -158,9 +158,109 @@ class TDTestCase:
tdSql
.
error
(
f
'alter table
{
dbname
}
.
{
tbname
}
modify column c1 bool'
)
tdSql
.
error
(
f
'alter table
{
dbname
}
.
{
tbname
}
modify column c1 binary(10)'
)
tdSql
.
execute
(
f
'drop database
{
dbname
}
'
)
def
alter_stb_column_check
(
self
):
dbname
=
self
.
get_long_name
(
length
=
10
,
mode
=
"letters"
)
tdSql
.
execute
(
f
'create database if not exists
{
dbname
}
'
)
stbname
=
self
.
get_long_name
(
length
=
3
,
mode
=
"letters"
)
tbname
=
self
.
get_long_name
(
length
=
3
,
mode
=
"letters"
)
tdSql
.
execute
(
f
'create database if not exists
{
dbname
}
'
)
tdSql
.
execute
(
f
'use
{
dbname
}
'
)
tdSql
.
execute
(
f
'create table
{
stbname
}
(ts timestamp, c1 tinyint, c2 smallint, c3 int,
\
c4 bigint, c5 tinyint unsigned, c6 smallint unsigned, c7 int unsigned, c8 bigint unsigned, c9 float, c10 double, c11 bool,c12 binary(20),c13 nchar(20)) tags(t0 int) '
)
tdSql
.
execute
(
f
'create table
{
tbname
}
using
{
stbname
}
tags(1)'
)
tdSql
.
execute
(
f
'insert into
{
tbname
}
values (now,1,2,3,4,5,6,7,8,9.9,10.1,true,"abcd","涛思数据")'
)
tdSql
.
execute
(
f
'alter table
{
stbname
}
add column c14 int'
)
tdSql
.
query
(
f
'select c14 from
{
stbname
}
'
)
tdSql
.
checkRows
(
1
)
tdSql
.
execute
(
f
'alter table
{
stbname
}
add column `c15` int'
)
tdSql
.
query
(
f
'select c15 from
{
stbname
}
'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
f
'describe
{
stbname
}
'
)
tdSql
.
checkRows
(
17
)
tdSql
.
execute
(
f
'alter table
{
stbname
}
drop column c14'
)
tdSql
.
query
(
f
'describe
{
stbname
}
'
)
tdSql
.
checkRows
(
16
)
tdSql
.
execute
(
f
'alter table
{
stbname
}
drop column `c15`'
)
tdSql
.
query
(
f
'describe
{
stbname
}
'
)
tdSql
.
checkRows
(
15
)
tdSql
.
execute
(
f
'alter table
{
stbname
}
modify column c12 binary(30)'
)
tdSql
.
query
(
f
'describe
{
stbname
}
'
)
tdSql
.
checkData
(
12
,
2
,
30
)
tdSql
.
execute
(
f
'alter table
{
stbname
}
modify column `c12` binary(35)'
)
tdSql
.
query
(
f
'describe
{
stbname
}
'
)
tdSql
.
checkData
(
12
,
2
,
35
)
tdSql
.
error
(
f
'alter table
{
stbname
}
modify column `c12` binary(34)'
)
tdSql
.
execute
(
f
'alter table
{
stbname
}
modify column c13 nchar(30)'
)
tdSql
.
query
(
f
'describe
{
stbname
}
'
)
tdSql
.
checkData
(
13
,
2
,
30
)
tdSql
.
error
(
f
'alter table
{
stbname
}
modify column c13 nchar(29)'
)
tdSql
.
error
(
f
'alter table
{
stbname
}
rename column c1 c21'
)
tdSql
.
error
(
f
'alter table
{
stbname
}
modify column c1 int'
)
tdSql
.
error
(
f
'alter table
{
stbname
}
modify column c4 int'
)
tdSql
.
error
(
f
'alter table
{
stbname
}
modify column c8 int'
)
tdSql
.
error
(
f
'alter table
{
stbname
}
modify column c1 unsigned int'
)
tdSql
.
error
(
f
'alter table
{
stbname
}
modify column c9 double'
)
tdSql
.
error
(
f
'alter table
{
stbname
}
modify column c10 float'
)
tdSql
.
error
(
f
'alter table
{
stbname
}
modify column c11 int'
)
tdSql
.
execute
(
f
'drop database
{
dbname
}
'
)
def
alter_stb_tag_check
(
self
):
dbname
=
self
.
get_long_name
(
length
=
10
,
mode
=
"letters"
)
tdSql
.
execute
(
f
'create database if not exists
{
dbname
}
'
)
stbname
=
self
.
get_long_name
(
length
=
3
,
mode
=
"letters"
)
tbname
=
self
.
get_long_name
(
length
=
3
,
mode
=
"letters"
)
tdSql
.
execute
(
f
'create database if not exists
{
dbname
}
'
)
tdSql
.
execute
(
f
'use
{
dbname
}
'
)
tdSql
.
execute
(
f
'create table
{
stbname
}
(ts timestamp, c1 int) tags(ts_tag timestamp, t1 tinyint, t2 smallint, t3 int,
\
t4 bigint, t5 tinyint unsigned, t6 smallint unsigned, t7 int unsigned, t8 bigint unsigned, t9 float, t10 double, t11 bool,t12 binary(20),t13 nchar(20)) '
)
tdSql
.
execute
(
f
'create table
{
tbname
}
using
{
stbname
}
tags(now,1,2,3,4,5,6,7,8,9.9,10.1,true,"abcd","涛思数据")'
)
tdSql
.
execute
(
f
'insert into
{
tbname
}
values(now,1)'
)
tdSql
.
execute
(
f
'alter table
{
stbname
}
add tag t14 int'
)
tdSql
.
query
(
f
'select t14 from
{
stbname
}
'
)
tdSql
.
checkRows
(
1
)
tdSql
.
execute
(
f
'alter table
{
stbname
}
add tag `t15` int'
)
tdSql
.
query
(
f
'select t14 from
{
stbname
}
'
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
f
'describe
{
stbname
}
'
)
tdSql
.
checkRows
(
18
)
tdSql
.
execute
(
f
'alter table
{
stbname
}
drop tag t14'
)
tdSql
.
query
(
f
'describe
{
stbname
}
'
)
tdSql
.
checkRows
(
17
)
tdSql
.
execute
(
f
'alter table
{
stbname
}
drop tag `t15`'
)
tdSql
.
query
(
f
'describe
{
stbname
}
'
)
tdSql
.
checkRows
(
16
)
tdSql
.
execute
(
f
'alter table
{
stbname
}
modify tag t12 binary(30)'
)
tdSql
.
query
(
f
'describe
{
stbname
}
'
)
tdSql
.
checkData
(
14
,
2
,
30
)
tdSql
.
execute
(
f
'alter table
{
stbname
}
modify tag `t12` binary(35)'
)
tdSql
.
query
(
f
'describe
{
stbname
}
'
)
tdSql
.
checkData
(
14
,
2
,
35
)
tdSql
.
error
(
f
'alter table
{
stbname
}
modify tag `t12` binary(34)'
)
tdSql
.
execute
(
f
'alter table
{
stbname
}
modify tag t13 nchar(30)'
)
tdSql
.
query
(
f
'describe
{
stbname
}
'
)
tdSql
.
checkData
(
15
,
2
,
30
)
tdSql
.
error
(
f
'alter table
{
stbname
}
modify tag t13 nchar(29)'
)
tdSql
.
execute
(
f
'alter table
{
stbname
}
rename tag t1 t21'
)
tdSql
.
query
(
f
'describe
{
stbname
}
'
)
tdSql
.
checkData
(
3
,
0
,
't21'
)
tdSql
.
execute
(
f
'alter table
{
stbname
}
rename tag `t21` t1'
)
tdSql
.
query
(
f
'describe
{
stbname
}
'
)
tdSql
.
checkData
(
3
,
0
,
't1'
)
for
i
in
[
'bigint'
,
'unsigned int'
,
'float'
,
'double'
,
'binary(10)'
,
'nchar(10)'
]:
for
j
in
[
1
,
2
,
3
]:
tdSql
.
error
(
f
'alter table
{
stbname
}
modify tag t
{
j
}
{
i
}
'
)
for
i
in
[
'int'
,
'unsigned int'
,
'float'
,
'binary(10)'
,
'nchar(10)'
]:
tdSql
.
error
(
f
'alter table
{
stbname
}
modify tag t8
{
i
}
'
)
tdSql
.
error
(
f
'alter table
{
stbname
}
modify tag t4 int'
)
tdSql
.
execute
(
f
'drop database
{
dbname
}
'
)
def
run
(
self
):
self
.
alter_tb_tag_check
()
self
.
alter_ntb_column_check
()
self
.
alter_stb_column_check
()
self
.
alter_stb_tag_check
()
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/system-test/2-query/To_iso8601.py
浏览文件 @
cda7463a
...
...
@@ -20,39 +20,35 @@ class TDTestCase:
# print(today_date)
time_zone
=
(
os
.
popen
(
'timedatectl | grep zone'
).
read
().
strip
().
split
(
','
)[
1
].
lstrip
())[
0
:
5
]
print
(
time_zone
)
tdSql
.
execute
(
'create database db1 precision "ms"'
)
tdSql
.
execute
(
'use db1'
)
tdSql
.
execute
(
'create table if not exists ntb(ts timestamp, c1 int, c2 timestamp)'
)
tdSql
.
execute
(
'create table if not exists ntb(ts timestamp, c1 int, c2 timestamp)'
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into ntb values(%d, %d, %d)"
%
(
self
.
ts
+
i
,
i
+
1
,
self
.
ts
+
i
))
tdSql
.
query
(
'select to_iso8601(ts) from ntb'
)
print
(
tdSql
.
queryResult
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
f
'2022-01-01T00:00:00.00
{
i
}{
time_zone
}
'
)
for
j
in
[
'z'
,
'Z'
]:
tdSql
.
query
(
'select to_iso8601(ts,"{j}") from ntb'
)
print
(
tdSql
.
queryResult
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
f
'2022-01-01T00:00:00.00
{
i
}{
time_zone
}
'
)
timezone_list
=
[
'+0000'
,
'+0100'
,
'+0200'
,
'+0300'
,
'+0330'
,
'+0400'
,
'+0500'
,
'+0530'
,
'+0600'
,
'+0700'
,
'+0800'
,
'+0900'
,
'+1000'
,
'+1100'
,
'+1200'
,
\
'+00'
,
'+01'
,
'+02'
,
'+03'
,
'+04'
,
'+05'
,
'+06'
,
'+07'
,
'+08'
,
'+09'
,
'+10'
,
'+11'
,
'+12'
,
\
'+00:00'
,
'+01:00'
,
'+02:00'
,
'+03:00'
,
'+03:30'
,
'+04:00'
,
'+05:00'
,
'+05:30'
,
'+06:00'
,
'+07:00'
,
'+08:00'
,
'+09:00'
,
'+10:00'
,
'+11:00'
,
'+12:00'
,
\
'-0000'
,
'-0100'
,
'-0200'
,
'-0300'
,
'-0400'
,
'-0500'
,
'-0600'
,
'-0700'
,
'-0800'
,
'-0900'
,
'-1000'
,
'-1100'
,
'-1200'
,
\
'-00'
,
'-01'
,
'-02'
,
'-03'
,
'-04'
,
'-05'
,
'-06'
,
'-07'
,
'-08'
,
'-09'
,
'-10'
,
'-11'
,
'-12'
,
\
'-00:00'
,
'-01:00'
,
'-02:00'
,
'-03:00'
,
'-04:00'
,
'-05:00'
,
'-06:00'
,
'-07:00'
,
'-08:00'
,
'-09:00'
,
'-10:00'
,
'-11:00'
,
'-12:00'
]
'-00:00'
,
'-01:00'
,
'-02:00'
,
'-03:00'
,
'-04:00'
,
'-05:00'
,
'-06:00'
,
'-07:00'
,
'-08:00'
,
'-09:00'
,
'-10:00'
,
'-11:00'
,
'-12:00'
\
'z'
,
'Z'
]
for
j
in
timezone_list
:
tdSql
.
query
(
f
'select to_iso8601(ts,"
{
j
}
") from ntb'
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
f
'2022-01-01T00:00:00.00
{
i
}{
time_zone
}
'
)
error_param_list
=
[
0
,
100
,
5
,
'a'
,
'+13'
,
'+0101'
,
'+00:01'
,
'-0001'
,
'-13'
,
'-00:01
'
]
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
i
][
0
],
f
'2022-01-01T00:00:00.00
{
i
}{
j
}
'
)
error_param_list
=
[
0
,
100
.5
,
'a'
,
'!
'
]
for
i
in
error_param_list
:
tdSql
.
error
(
f
'select to_iso8601(ts,"
{
error_param_list
}
") from ntb'
)
tdSql
.
error
(
f
'select to_iso8601(ts,"
{
i
}
") from ntb'
)
# bug TD-16372:对于错误的时区,缺少校验
# error_timezone_param = ['+13','-13','+1300','-1300','+0001','-0001','-0330','+0330']
# for i in error_timezone_param:
# tdSql.error(f'select to_iso8601(ts,"{i}") from ntb')
def
check_base_function
(
self
):
tdSql
.
prepare
()
...
...
@@ -74,12 +70,9 @@ class TDTestCase:
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select to_iso8601(ts) from ntb where ts=today()"
)
tdSql
.
checkRows
(
1
)
# tdSql.checkData(0,0,10)
for
i
in
range
(
1
,
10
):
for
i
in
range
(
0
,
3
):
tdSql
.
query
(
"select to_iso8601(1) from ntb"
)
tdSql
.
checkData
(
0
,
0
,
"1970-01-01T08:00:01+0800"
)
i
+=
1
sleep
(
0.2
)
tdSql
.
checkData
(
i
,
0
,
"1970-01-01T08:00:01+0800"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select to_iso8601(ts) from ntb"
)
tdSql
.
checkRows
(
3
)
...
...
@@ -113,12 +106,13 @@ class TDTestCase:
for
i
in
err_param
:
tdSql
.
error
(
f
"select to_iso8601(
{
i
}
) from ntb"
)
tdSql
.
error
(
f
"select to_iso8601(
{
i
}
) from db.ntb"
)
tdSql
.
query
(
"select to_iso8601(now) from stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select to_iso8601(now()) from stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select to_iso8601(1) from stb"
)
for
i
in
range
(
1
,
10
):
for
i
in
range
(
0
,
3
):
tdSql
.
checkData
(
i
,
0
,
"1970-01-01T08:00:01+0800"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select to_iso8601(ts) from stb"
)
...
...
@@ -128,20 +122,17 @@ class TDTestCase:
tdSql
.
query
(
"select to_iso8601(ts)+'a' from stb "
)
tdSql
.
checkRows
(
3
)
for
i
in
[
'+'
,
'-'
,
'*'
,
'/'
]:
tdSql
.
query
(
"select to_iso8601(today()) {i}null from stb"
)
tdSql
.
query
(
f
"select to_iso8601(today())
{
i
}
null from stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select to_iso8601(today()) {i}null from db.stb"
)
tdSql
.
query
(
f
"select to_iso8601(today())
{
i
}
null from db.stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
# bug TD-15207
# tdSql.query("select to_iso8601(-1) from ntb")
# tdSql.checkRows(3)
def
run
(
self
):
# sourcery skip: extract-duplicate-method
self
.
check_base_function
()
self
.
check_customize_param_ms
()
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录