test case

This commit is contained in:
factosea 2024-12-24 17:22:39 +08:00
parent 79b4b4bec1
commit 4779f4a16f
3 changed files with 85 additions and 0 deletions

View File

@ -247,6 +247,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/agg_group_NotReturnValue.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/td-32548.py
,,n,system-test,python3 ./test.py -f 2-query/large_data.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/stddev_test.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/stddev_test.py -Q 2

View File

@ -19,6 +19,7 @@ import inspect
import importlib
import traceback
from util.log import *
import platform
class TDCase:
@ -146,5 +147,42 @@ class TDCases:
tdLog.notice("total %d Cluster test case(s) executed" % (runNum))
def getTaosBenchmarkPath(self, tool="taosBenchmark"):
if (platform.system().lower() == 'windows'):
tool = tool + ".exe"
selfPath = os.path.dirname(os.path.realpath(__file__))
if "community" in selfPath:
projPath = selfPath[: selfPath.find("community")]
else:
projPath = selfPath[: selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if (tool) in files:
rootRealPath = os.path.dirname(os.path.realpath(root))
if "packaging" not in rootRealPath:
paths.append(os.path.join(root, tool))
break
if len(paths) == 0:
tdLog.exit("taosBenchmark not found!")
return
else:
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]
def taosBenchmarkExec(self, param):
buildPath = tdCases.getTaosBenchmarkPath()
if (platform.system().lower() == 'windows'):
cmdStr1 = ' mintty -h never %s %s '%(buildPath, param)
tdLog.info(cmdStr1)
os.system(cmdStr1)
else:
cmdStr1 = '%s %s &'%(buildPath, param)
tdLog.info(cmdStr1)
os.system(cmdStr1)
time.sleep(15)
tdCases = TDCases()

View File

@ -0,0 +1,46 @@
from util.log import *
from util.sql import *
from util.cases import *
from util.dnodes import *
class TDTestCase:
def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar)
tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor(), True)
def prepare_data(self):
tdSql.execute("drop database if exists test;")
tdCases.taosBenchmarkExec("-t 2 -n 1000000 -b int,float,nchar -y")
def ts5803(self):
tdSql.query("select d0.ts,d0.c1,d0.c2 from test.d0 join test.d1 on d0.ts=d1.ts;")
num1 = tdSql.queryRows
tdSql.query("select d0.ts,d0.c1,d0.c2 from test.d0 join test.d1 on d0.ts=d1.ts limit 1000000;")
tdSql.checkRows(num1)
tdSql.query("select d0.ts from test.d0 join test.d1 on d0.ts=d1.ts limit 1000000;")
tdSql.checkRows(num1)
tdSql.query("select d0.ts,d0.c1,d0.c2 from test.d0 left join test.d1 on d0.ts=d1.ts;")
num1 = tdSql.queryRows
tdSql.query("select d0.ts,d0.c1,d0.c2 from test.d0 left join test.d1 on d0.ts=d1.ts limit 1000000;")
tdSql.checkRows(num1)
tdSql.query("select d0.ts from test.d0 left join test.d1 on d0.ts=d1.ts limit 1000000;")
tdSql.checkRows(num1)
def run(self):
self.prepare_data()
self.ts5803()
def stop(self):
tdSql.close()
tdLog.success(f"{__file__} successfully executed")
tdCases.addLinux(__file__, TDTestCase())
tdCases.addWindows(__file__, TDTestCase())