case: mlevel_basic.py passed

This commit is contained in:
root 2023-12-25 19:56:56 +08:00
parent f567c19d05
commit 5f0b0b4338
6 changed files with 31 additions and 27 deletions

View File

@ -16,12 +16,13 @@ import time
import taos import taos
import frame import frame
import frame.etool
from frame.log import * from frame.log import *
from frame.cases import * from frame.cases import *
from frame.sql import * from frame.sql import *
from frame.caseBase import * from frame.caseBase import *
from frame import *
class TDTestCase(TBase): class TDTestCase(TBase):
@ -30,9 +31,10 @@ class TDTestCase(TBase):
def insertData(self): def insertData(self):
tdLog.info(f"insert data.") tdLog.info(f"insert data.")
# taosBenchmark run # taosBenchmark run
json = frame.etool.curFile(__file__, "mlevel_basic.json") json = etool.curFile(__file__, "mlevel_basic.json")
frame.etool.runBenchmark(json=json) etool.runBenchmark(json=json)
tdSql.execute(f"use {self.db}")
# set insert data information # set insert data information
self.childtable_count = 2 self.childtable_count = 2
self.insert_rows = 1000000 self.insert_rows = 1000000

View File

@ -16,11 +16,11 @@ import os
import time import time
import datetime import datetime
from log import * from frame.log import *
from sql import * from frame.sql import *
# test case base # test case base
class DbBase: class TBase:
# #
# frame call # frame call
@ -85,7 +85,7 @@ class DbBase:
tdSql.checkAgg(sql, self.childtable_count) tdSql.checkAgg(sql, self.childtable_count)
# check step # check step
sql = f"select count(*) from (select diff(ts) as dif from {self.stb} group by tbname) where dif != {self.timestamp_step}" sql = f"select count(*) from (select diff(ts) as dif from {self.stb} partition by tbname) where dif != {self.timestamp_step}"
tdSql.checkAgg(sql, 0) tdSql.checkAgg(sql, 0)
# save agg result # save agg result

View File

@ -22,7 +22,7 @@ import datetime
# if windows platform return True # if windows platform return True
def isWin(): def isWin():
return sys.platform.system().lower() == 'windows' return sys.platform.lower() == 'windows'
# wait util execute file finished # wait util execute file finished
def exe(file): def exe(file):

View File

@ -19,13 +19,13 @@ import os
from frame.log import * from frame.log import *
# build/bin path # build/bin path
binPath = "" binDir = ""
def binPath(self): def binPath():
global binPath global binDir
if binPath != "": if binDir != "":
return binPath return binDir
selfPath = os.path.dirname(os.path.realpath(__file__)) selfPath = os.path.dirname(os.path.realpath(__file__))
@ -46,8 +46,8 @@ def binPath(self):
else: else:
tdLog.info(f"taosd found in {buildPath}") tdLog.info(f"taosd found in {buildPath}")
# return # return
binPath = buildPath + "/build/bin/" binDir = buildPath + "/build/bin/"
return binPath return binDir
def binFile(self, file): def binFile(filename):
return binPath() + file return binPath() + filename

View File

@ -19,22 +19,24 @@ import sys
import os import os
import time import time
import datetime import datetime
import epath import frame.epath
import eos import frame.eos
# run taosBenchmark with command or json file mode # run taosBenchmark with command or json file mode
def runBenchmark(command = "", json = "") : def runBenchmark(command = "", json = "") :
# get taosBenchmark path # get taosBenchmark path
bmFile = epath.binFile("taosBenchmark") bmFile = frame.epath.binFile("taosBenchmark")
if eos.isWin(): if frame.eos.isWin():
bmFile += ".exe" bmFile += ".exe"
# run # run
if command != "": if command != "":
eos.exe(bmFile + " " + command) frame.eos.exe(bmFile + " " + command)
if json != "": if json != "":
eos.exe(bmFile + " -f " + json) cmd = f"{bmFile} -f {json}"
print(cmd)
frame.eos.exe(cmd)
# get current directory file name # get current directory file name
def curFile(fullPath, file): def curFile(fullPath, filename):
return os.path.dirname(fullPath) + "/" + file return os.path.dirname(fullPath) + "/" + filename

View File

@ -538,7 +538,7 @@ class TDSql:
# check like select count(*) ... sql # check like select count(*) ... sql
def checkAgg(self, sql, expectCnt): def checkAgg(self, sql, expectCnt):
self.query(sql) self.query(sql)
self.checkRowCol(0, 0, expectCnt) self.checkData(0, 0, expectCnt)
# get first value # get first value
def getFirstValue(self, sql) : def getFirstValue(self, sql) :