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 frame
import frame.etool
from frame.log import *
from frame.cases import *
from frame.sql import *
from frame.caseBase import *
from frame import *
class TDTestCase(TBase):
@ -30,9 +31,10 @@ class TDTestCase(TBase):
def insertData(self):
tdLog.info(f"insert data.")
# taosBenchmark run
json = frame.etool.curFile(__file__, "mlevel_basic.json")
frame.etool.runBenchmark(json=json)
json = etool.curFile(__file__, "mlevel_basic.json")
etool.runBenchmark(json=json)
tdSql.execute(f"use {self.db}")
# set insert data information
self.childtable_count = 2
self.insert_rows = 1000000
@ -76,4 +78,4 @@ class TDTestCase(TBase):
tdCases.addLinux(__file__, TDTestCase())
tdCases.addWindows(__file__, TDTestCase())
tdCases.addWindows(__file__, TDTestCase())

View File

@ -16,11 +16,11 @@ import os
import time
import datetime
from log import *
from sql import *
from frame.log import *
from frame.sql import *
# test case base
class DbBase:
class TBase:
#
# frame call
@ -85,7 +85,7 @@ class DbBase:
tdSql.checkAgg(sql, self.childtable_count)
# 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)
# save agg result

View File

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

View File

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

View File

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

View File

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