Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dec9d63c
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看板
未验证
提交
dec9d63c
编写于
4月 28, 2022
作者:
J
Jason-Jia
提交者:
GitHub
4月 28, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11961 from taosdata/test/jcy
test: add cases for timezone and now
上级
91780376
98ced775
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
259 addition
and
6 deletion
+259
-6
tests/pytest/util/sql.py
tests/pytest/util/sql.py
+2
-0
tests/system-test/2-query/Now.py
tests/system-test/2-query/Now.py
+124
-1
tests/system-test/2-query/To_iso8061.py
tests/system-test/2-query/To_iso8061.py
+69
-0
tests/system-test/2-query/timezone.py
tests/system-test/2-query/timezone.py
+64
-5
未找到文件。
tests/pytest/util/sql.py
浏览文件 @
dec9d63c
...
...
@@ -16,6 +16,7 @@ import os
import
time
import
datetime
import
inspect
import
traceback
import
psutil
import
shutil
import
pandas
as
pd
...
...
@@ -88,6 +89,7 @@ class TDSql:
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
1
][
0
])
args
=
(
caller
.
filename
,
caller
.
lineno
,
sql
,
repr
(
e
))
tdLog
.
notice
(
"%s(%d) failed: sql:%s, %s"
%
args
)
traceback
.
print_exc
()
raise
Exception
(
repr
(
e
))
if
row_tag
:
return
self
.
queryResult
...
...
tests/system-test/2-query/Now.py
浏览文件 @
dec9d63c
from
util.dnodes
import
*
from
util.log
import
*
from
util.sql
import
*
...
...
@@ -111,21 +110,72 @@ class TDTestCase:
tdSql
.
query
(
"select * from ntb where ts<now()"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
1
,
1
,
3
)
tdSql
.
query
(
"select * from db.ntb where ts<now()"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
1
,
1
,
3
)
tdSql
.
query
(
"select * from ntb where ts<=now()"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
2
,
1
,
1
)
tdSql
.
query
(
"select * from db.ntb where ts<=now()"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
2
,
1
,
1
)
tdSql
.
query
(
"select c1 from ntb where ts=now()"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select c1 from db.ntb where ts=now()"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from ntb where ts>=now()"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from db.ntb where ts>=now()"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from ntb where ts>now()"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from db.ntb where ts>now()"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select now() from ntb where ts=today()"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select now() from db.ntb where ts=today()"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select now()+1 from ntb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select now()+1 from db.ntb"
)
tdSql
.
checkRows
(
3
)
# tdSql.query("select now()+9223372036854775807 from ntb")
# tdSql.checkRows(3)
tdSql
.
error
(
"select now()+1.5 from ntb"
)
tdSql
.
error
(
"select now()+1.5 from db.ntb"
)
tdSql
.
error
(
"select now()+'abc' from ntb"
)
tdSql
.
error
(
"select now()+'abc' from db.ntb"
)
tdSql
.
error
(
"select now()+abc from ntb"
)
tdSql
.
error
(
"select now()+abc from db.ntb"
)
tdSql
.
error
(
"select now()+! from ntb"
)
tdSql
.
error
(
"select now()+! from db.ntb"
)
tdSql
.
query
(
"select now()+null from ntb"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()+null from db.ntb"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()-null from ntb"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()-null from db.ntb"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()*null from ntb"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()*null from db.ntb"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()/null from ntb"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()/null from db.ntb"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
error
(
"select now() +today() from ntb"
)
tdSql
.
error
(
"select now() +today() from db.ntb"
)
# stable
tdSql
.
query
(
"select now() from stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select now() from db.stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select now() +1w from stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select now() +1w from db.stb"
)
...
...
@@ -198,16 +248,52 @@ class TDTestCase:
# tdSql.checkData(2,1,1)
tdSql
.
query
(
"select c1 from stb where ts=now()"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select c1 from db.stb where ts=now()"
)
tdSql
.
checkRows
(
0
)
# tdSql.query("select * from stb where ts>=now()")
# tdSql.checkRows(0)
# tdSql.query("select * from stb where ts>now()")
# tdSql.checkRows(0)
tdSql
.
query
(
"select now() from stb where ts=today()"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select now() from db.stb where ts=today()"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select now() +1 from stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select now() +1 from db.stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
error
(
"select now() +'abc' from stb"
)
tdSql
.
error
(
"select now() +'abc' from db.stb"
)
tdSql
.
error
(
"select now() + ! from stb"
)
tdSql
.
error
(
"select now() + ! from db.stb"
)
tdSql
.
error
(
"select now() + today() from stb"
)
tdSql
.
error
(
"select now() + today() from db.stb"
)
tdSql
.
error
(
"select now() -today() from stb"
)
tdSql
.
error
(
"select now() - today() from db.stb"
)
tdSql
.
query
(
"select now()+null from stb"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()+null from db.stb"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()-null from stb"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()-null from db.stb"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()*null from stb"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()*null from db.stb"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()/null from stb"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()/null from db.stb"
)
tdSql
.
checkData
(
0
,
0
,
None
)
# table
tdSql
.
query
(
"select now() from stb_1"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select now() from db.stb_1"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select now() +1w from stb_1"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select now() +1w from db.stb_1"
)
...
...
@@ -275,15 +361,27 @@ class TDTestCase:
tdSql
.
query
(
"select * from stb_1 where ts<now()"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
1
,
1
,
3
)
tdSql
.
query
(
"select * from db.stb_1 where ts<now()"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
1
,
1
,
3
)
tdSql
.
query
(
"select * from stb_1 where ts<=now()"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
2
,
1
,
1
)
tdSql
.
query
(
"select * from db.stb_1 where ts<=now()"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
2
,
1
,
1
)
tdSql
.
query
(
"select c1 from stb_1 where ts=now()"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select c1 from db.stb_1 where ts=now()"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from stb_1 where ts>=now()"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from db.stb_1 where ts>=now()"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from stb_1 where ts>now()"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from db.stb_1 where ts>now()"
)
tdSql
.
checkRows
(
0
)
# tdSql.query("select * from stb_1 where ts<now")
# tdSql.checkRows(3)
...
...
@@ -301,6 +399,31 @@ class TDTestCase:
tdSql
.
query
(
"select now() from stb_1 where ts=today()"
)
tdSql
.
checkRows
(
1
)
tdSql
.
error
(
"select now() +'abc' from stb_1"
)
tdSql
.
error
(
"select now() +'abc' from db.stb_1"
)
tdSql
.
error
(
"select now() + ! from stb_1"
)
tdSql
.
error
(
"select now() + ! from db.stb_1"
)
tdSql
.
error
(
"select now() + today() from stb_1"
)
tdSql
.
error
(
"select now() + today() from db.stb_1"
)
tdSql
.
error
(
"select now() - today() from stb_1"
)
tdSql
.
error
(
"select now()-today() from db.stb_1"
)
tdSql
.
query
(
"select now()+null from stb_1"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()+null from db.stb_1"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()-null from stb_1"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()-null from db.stb_1"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()*null from stb_1"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()*null from db.stb_1"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()/null from stb_1"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select now()/null from db.stb_1"
)
tdSql
.
checkData
(
0
,
0
,
None
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
...
...
tests/system-test/2-query/To_iso8061.py
浏览文件 @
dec9d63c
...
...
@@ -67,6 +67,75 @@ class TDTestCase:
tdSql
.
error
(
"select to_iso8601(timezone()) from ntb"
)
tdSql
.
error
(
"select to_iso8601('abc') from ntb"
)
tdSql
.
query
(
"select to_iso8601(today()) *null from ntb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select to_iso8601(today()) +null from ntb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select to_iso8601(today()) -null from ntb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select to_iso8601(today()) /null from ntb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select to_iso8601(today()) *null from db.ntb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select to_iso8601(today()) +null from db.ntb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select to_iso8601(today()) -null from db.ntb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select to_iso8601(today()) /null from db.ntb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select to_iso8601(now) from stb"
)
tdSql
.
query
(
"select to_iso8601(now()) from stb"
)
tdSql
.
checkRows
(
3
)
for
i
in
range
(
1
,
10
):
tdSql
.
query
(
"select to_iso8601(1) from stb"
)
tdSql
.
checkData
(
0
,
0
,
"1970-01-01T08:00:01+0800"
)
i
+=
1
sleep
(
0.2
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select to_iso8601(ts) from stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select to_iso8601(ts)+1 from stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select to_iso8601(ts)+'a' from stb "
)
tdSql
.
checkRows
(
3
)
# tdSql.query()
tdSql
.
query
(
"select to_iso8601(today()) *null from stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select to_iso8601(today()) +null from stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select to_iso8601(today()) -null from stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select to_iso8601(today()) /null from stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select to_iso8601(today()) *null from db.stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select to_iso8601(today()) +null from db.stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select to_iso8601(today()) -null from db.stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select to_iso8601(today()) /null from db.stb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
None
)
...
...
tests/system-test/2-query/timezone.py
浏览文件 @
dec9d63c
...
...
@@ -45,20 +45,15 @@ class TDTestCase:
tdSql
.
query
(
"select timezone() from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
time_zone
)
tdSql
.
query
(
"select timezone() from db.ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
time_zone
)
tdSql
.
query
(
"select timezone() from stb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
time_zone
)
tdSql
.
query
(
"select timezone() from db.stb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
time_zone
)
tdSql
.
query
(
"select timezone() from stb_1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
time_zone
)
...
...
@@ -66,14 +61,78 @@ class TDTestCase:
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
time_zone
)
tdSql
.
error
(
"select timezone(1) from stb"
)
tdSql
.
error
(
"select timezone(1) from db.stb"
)
tdSql
.
error
(
"select timezone(1) from ntb"
)
tdSql
.
error
(
"select timezone(1) from db.ntb"
)
tdSql
.
error
(
"select timezone(1) from stb_1"
)
tdSql
.
error
(
"select timezone(1) from db.stb_1"
)
tdSql
.
error
(
"select timezone(now()) from stb"
)
tdSql
.
error
(
"select timezone(now()) from db.stb"
)
tdSql
.
query
(
f
"select * from ntb where timezone()='
{
time_zone
}
'"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()+1 from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()+1 from db.ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()+1 from stb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()+1 from db.stb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()+1 from stb_1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()+1 from db.stb_1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()+1.5 from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()+1.5 from db.ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()-100 from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()*100 from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()/10 from ntb"
)
# tdSql.query("select timezone()/0 from ntb")
tdSql
.
query
(
"select timezone()+null from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()-null from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()*null from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()/null from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
# tdSql.query("select timezone()")
tdSql
.
query
(
"select timezone()+null from stb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()-null from stb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()*null from stb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()/null from stb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()+null from stb_1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()-null from stb_1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()*null from stb_1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()/null from stb_1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录