update
This commit is contained in:
parent
7ad15516e6
commit
24ac70fc41
|
@ -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
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
|
||||
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")
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue