update test case

This commit is contained in:
yihaoDeng 2024-11-28 18:54:28 +08:00
parent 64d47ead85
commit 1041e8e5b1
1 changed files with 5 additions and 5 deletions

View File

@ -55,13 +55,12 @@ class TDTestCase:
for item in queryRes: for item in queryRes:
if "Disk_occupied=" in item[0]: if "Disk_occupied=" in item[0]:
disk_occupied= int(item[0].split("=")[1].split(" ")[0].replace("[", "").replace("k]", "")) disk_occupied= int(item[0].split("=")[1].split(" ")[0].replace("[", "").replace("k]", ""))
tdLog.debug("disk_occupied: %s" % disk_occupied) #tdLog.debug("disk_occupied: %s" % disk_occupied)
elif "Compress_radio=" in item[0]: elif "Compress_radio=" in item[0]:
value = item[0].split("=")[1].split(" ")[0].replace("[", "").replace("]", "") value = item[0].split("=")[1].split(" ")[0].replace("[", "").replace("]", "")
if value != 'NULL': if value != 'NULL':
compress_radio = float(value) compress_radio = float(value)
#tdLog.debug("compress_occupied: %s" % compress_radio)
tdLog.debug("compress_occupied: %s" % compress_radio)
return disk_occupied, compress_radio return disk_occupied, compress_radio
def insertData(self): def insertData(self):
@ -72,7 +71,7 @@ class TDTestCase:
for i in range(self.ctnum): for i in range(self.ctnum):
tdSql.execute(f'create table ct_{str(i+1)} using {self.stname} tags ("name{str(i+1)}");') tdSql.execute(f'create table ct_{str(i+1)} using {self.stname} tags ("name{str(i+1)}");')
sql = f"insert into ct_{str(i+1)} values " sql = f"insert into ct_{str(i+1)} values "
for j in range(self.row_num): for j in range(self.row_num * 2):
sql += f"(now+{j+1}s, {j+1}, {random.uniform(15, 30)}) " sql += f"(now+{j+1}s, {j+1}, {random.uniform(15, 30)}) "
sql += ";" sql += ";"
tdSql.execute(sql) tdSql.execute(sql)
@ -116,9 +115,10 @@ class TDTestCase:
self.insertData() self.insertData()
tdSql.execute(f"flush database {self.other_dbname};")
tdSql.query(f"show {self.other_dbname}.disk_info;") tdSql.query(f"show {self.other_dbname}.disk_info;")
tdLog.debug(tdSql.queryResult)
disk_occupied,compress_radio = self.checkRes(tdSql.queryResult) disk_occupied,compress_radio = self.checkRes(tdSql.queryResult)
tdLog.debug("database: %s, disk_occupied: %s, compress_radio: %s" % (self.other_dbname,disk_occupied, compress_radio))
tdSql.query(f"select sum(data1+data2+data3) from information_schema.ins_disk_usage where db_name='{self.other_dbname}';") tdSql.query(f"select sum(data1+data2+data3) from information_schema.ins_disk_usage where db_name='{self.other_dbname}';")
tdSql.checkData(0,0,disk_occupied) tdSql.checkData(0,0,disk_occupied)