Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
24ac70fc
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
24ac70fc
编写于
4月 27, 2022
作者:
J
jiacy-jcy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
7ad15516
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
77 addition
and
2 deletion
+77
-2
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
+73
-2
tests/system-test/2-query/timezone.py
tests/system-test/2-query/timezone.py
+2
-0
未找到文件。
tests/pytest/util/sql.py
浏览文件 @
24ac70fc
...
...
@@ -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
浏览文件 @
24ac70fc
import
traceback
from
util.dnodes
import
*
from
util.log
import
*
from
util.sql
import
*
...
...
@@ -111,32 +112,66 @@ 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()+
9223372036854775807 from
ntb"
)
tdSql
.
query
(
"select now()+
1 from db.
ntb"
)
tdSql
.
checkRows
(
3
)
# tdSql.query("select now()+9223372036854775807 from ntb")
# tdSql.checkRows(3)
tdSql
.
query
(
"select now()+1.5 from ntb"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select now()+1.5 from db.ntb"
)
tdSql
.
checkRows
(
3
)
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.error("select now()+null from ntb")
# tdSql.error("select now()+null from db.ntb")
# tdSql.error("select now()-null from ntb")
# tdSql.error("select now()-null from db.ntb")
# tdSql.error("select now()*null from ntb")
# tdSql.error("select now()*null from db.ntb")
# tdSql.error("select now()/null from ntb")
# tdSql.error("select now()/null from db.ntb")
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"
)
...
...
@@ -209,16 +244,33 @@ 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"
)
# 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"
)
...
...
@@ -286,15 +338,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)
...
...
@@ -312,6 +376,13 @@ 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"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
...
...
tests/system-test/2-query/timezone.py
浏览文件 @
24ac70fc
...
...
@@ -75,6 +75,8 @@ class TDTestCase:
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()+1.5 from ntb"
)
# tdSql.query("select timezone()")
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录