From 72988572386ce5c911eed30829fde70b91fcc878 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Sun, 1 Sep 2024 22:20:56 +0800 Subject: [PATCH] tetst:modify failed cases in windows ci --- tests/army/frame/taosadapter.py | 2 +- tests/system-test/0-others/backquote_check.py | 32 ++++++++--------- tests/system-test/0-others/splitVGroup.py | 19 ++++++----- tests/system-test/0-others/splitVGroupWal.py | 19 ++++++----- tests/system-test/0-others/taosdShell.py | 5 ++- tests/system-test/1-insert/alter_database.py | 5 ++- tests/system-test/1-insert/precisionNS.py | 12 ++++--- tests/system-test/1-insert/precisionUS.py | 12 ++++--- tests/system-test/2-query/last+last_row.py | 34 ++++++++++++------- tests/system-test/7-tmq/tmq3mnodeSwitch.py | 3 ++ 10 files changed, 83 insertions(+), 60 deletions(-) diff --git a/tests/army/frame/taosadapter.py b/tests/army/frame/taosadapter.py index 7830aab08c..e52f555ace 100644 --- a/tests/army/frame/taosadapter.py +++ b/tests/army/frame/taosadapter.py @@ -64,7 +64,7 @@ class TAdapter: "enable" : True }, "node_exporter" : { - "enable" : True + "enable" : False }, "prometheus" : { "enable" : True diff --git a/tests/system-test/0-others/backquote_check.py b/tests/system-test/0-others/backquote_check.py index 2858373ced..b580dd0261 100644 --- a/tests/system-test/0-others/backquote_check.py +++ b/tests/system-test/0-others/backquote_check.py @@ -42,19 +42,19 @@ class TDTestCase: type = 'stable' tdSql.execute(f'create topic if not exists {name} as {type} {name}') tdSql.query('show topics') - tdSql.checkEqual(tdSql.queryResult[0][0],name) + tdSql.checkData(0, 0, name) tdSql.execute(f'drop topic {name}') tdSql.execute(f'create topic if not exists `{name}` as {type} {name}') tdSql.query('show topics') - tdSql.checkEqual(tdSql.queryResult[0][0],name) + tdSql.checkData(0, 0, name) tdSql.execute(f'drop topic {name}') tdSql.execute(f'create topic if not exists `{name}` as {type} `{name}`') tdSql.query('show topics') - tdSql.checkEqual(tdSql.queryResult[0][0],name) + tdSql.checkData(0, 0, name) tdSql.execute(f'drop topic {name}') tdSql.execute(f'create topic if not exists `{name}` as {type} `{name}`') tdSql.query('show topics') - tdSql.checkEqual(tdSql.queryResult[0][0],name) + tdSql.checkData(0, 0, name) tdSql.execute(f'drop topic `{name}`') def db_name_check(self): @@ -70,14 +70,14 @@ class TDTestCase: time.sleep(15) tdSql.query('show streams') - tdSql.checkEqual(tdSql.queryResult[0][0],self.streamname) + tdSql.checkData(0, 0, self.streamname) tdSql.execute(f'drop stream {self.streamname}') tdSql.execute(f'drop stable {self.streamtb}') tdSql.execute(f'create stream {self.streamname} into `{self.streamtb}` as select count(*) from {self.stbname} interval(10s);') time.sleep(10) tdSql.query('show streams') - tdSql.checkEqual(tdSql.queryResult[0][0],self.streamname) + tdSql.checkData(0, 0, self.streamname) tdSql.execute(f'drop stream `{self.streamname}`') tdSql.execute(f'drop database {self.dbname}') @@ -89,17 +89,17 @@ class TDTestCase: tdSql.execute(f'insert into {self.ntbname1} values(now(),1,1)') tdSql.execute(f'insert into {self.ntbname2} values(now(),2,2)') tdSql.query(f'select `{self.ntbname1}`.`c0`, `{self.ntbname1}`.`c1` from `{self.ntbname1}`') - tdSql.checkEqual(tdSql.queryResult[0][0], 1) + tdSql.checkData(0, 0, 1) tdSql.query(f'select `{self.ntbname1}`.`c0`, `{self.ntbname1}`.`c1` from `{self.dbname}`.`{self.ntbname1}`') - tdSql.checkEqual(tdSql.queryResult[0][0], 1) + tdSql.checkData(0, 0, 1) tdSql.query(f'select `{self.ntbname1}`.`c0` from `{self.ntbname2}` `{self.ntbname1}`') - tdSql.checkEqual(tdSql.queryResult[0][0], 2) + tdSql.checkData(0, 0, 2) tdSql.query(f'select `{self.ntbname1}`.`c0` from (select * from `{self.ntbname2}`) `{self.ntbname1}`') - tdSql.checkEqual(tdSql.queryResult[0][0], 2) + tdSql.checkData(0, 0, 2) # select `t1`.`col1`, `col2`, `col3` from (select ts `col1`, 123 `col2`, c0 + c1 as `col3` from t2) `t1`; tdSql.query(f'select `{self.ntbname1}`.`col1`, `col2`, `col3` from (select ts `col1`, 123 `col2`, c0 + c1 as `col3` from {self.ntbname2}) `{self.ntbname1}`') - tdSql.checkEqual(tdSql.queryResult[0][1], 123) - tdSql.checkEqual(tdSql.queryResult[0][2], 4) + tdSql.checkData(0, 1, 123) + tdSql.checkData(0, 2, 4) # tdSql.execute(f'drop database {self.dbname}') @@ -117,15 +117,15 @@ class TDTestCase: tdSql.query(f'select `t1`.`ts`, `t1`.`c0` + `t2`.`c0` as `c0`, `t1`.`c1` * `t2`.`c1` as `c1` from `{self.ntbname1}` `t1` join `{self.ntbname2}` `t2` on timetruncate(`t1`.`ts`, 1s) = timetruncate(`t2`.`ts`, 1s);') tdSql.checkRows(1) - tdSql.checkEqual(tdSql.queryResult[0][1], 3) + tdSql.checkData(0, 1, 3) tdSql.query(f'select `t1`.`ts`, `t1`.`c1`, `t1`.`c2` from (select `ts`, `c0` + 1 as `c1`, `c1` + 2 as `c2` from `{self.ntbname1}`) `t1`;') - tdSql.checkEqual(tdSql.queryResult[0][1], 2) - tdSql.checkEqual(tdSql.queryResult[0][2], 3) + tdSql.checkData(0, 1, 2) + tdSql.checkData(0, 2, 3) tdSql.query(f'select `t`.`ts`, cast(`t`.`v1` as int) + `t`.`c0` as `v` from (select `ts`, "12" as `v1`, `c0`, `c1` from `ntb1`) `t`;') tdSql.checkRows(1) - tdSql.checkEqual(tdSql.queryResult[0][1], 13) + tdSql.checkData(0, 1, 13) tdSql.query(f'select count(`t1`.`ts`) from (select `t`.`ts` from `{self.ntbname1}` `t`) `t1`;') tdSql.checkRows(1) diff --git a/tests/system-test/0-others/splitVGroup.py b/tests/system-test/0-others/splitVGroup.py index c49713fc6d..df52828a6e 100644 --- a/tests/system-test/0-others/splitVGroup.py +++ b/tests/system-test/0-others/splitVGroup.py @@ -16,7 +16,7 @@ import random import time import copy import string - +import platform import taos from util.log import * from util.cases import * @@ -380,14 +380,15 @@ class TDTestCase: # forbid def checkForbid(self): # stream - tdLog.info("check forbid split having stream...") - tdSql.execute("create database streamdb;") - tdSql.execute("use streamdb;") - tdSql.execute("create table ta(ts timestamp, age int);") - tdSql.execute("create stream ma into sta as select count(*) from ta interval(1s);") - self.expectSplitError("streamdb") - tdSql.execute("drop stream ma;") - self.expectSplitOk("streamdb") + if platform.system().lower() != 'windows': + tdLog.info("check forbid split having stream...") + tdSql.execute("create database streamdb;") + tdSql.execute("use streamdb;") + tdSql.execute("create table ta(ts timestamp, age int);") + tdSql.execute("create stream ma into sta as select count(*) from ta interval(1s);") + self.expectSplitError("streamdb") + tdSql.execute("drop stream ma;") + self.expectSplitOk("streamdb") # topic tdLog.info("check forbid split having topic...") diff --git a/tests/system-test/0-others/splitVGroupWal.py b/tests/system-test/0-others/splitVGroupWal.py index d11d63b5a9..ecffd0f7c6 100644 --- a/tests/system-test/0-others/splitVGroupWal.py +++ b/tests/system-test/0-others/splitVGroupWal.py @@ -16,7 +16,7 @@ import random import time import copy import string - +import platform import taos from util.log import * from util.cases import * @@ -380,14 +380,15 @@ class TDTestCase: # forbid def checkForbid(self): # stream - tdLog.info("check forbid split having stream...") - tdSql.execute("create database streamdb;") - tdSql.execute("use streamdb;") - tdSql.execute("create table ta(ts timestamp, age int);") - tdSql.execute("create stream ma into sta as select count(*) from ta interval(1s);") - self.expectSplitError("streamdb") - tdSql.execute("drop stream ma;") - self.expectSplitOk("streamdb") + if platform.system().lower() != 'windows': + tdLog.info("check forbid split having stream...") + tdSql.execute("create database streamdb;") + tdSql.execute("use streamdb;") + tdSql.execute("create table ta(ts timestamp, age int);") + tdSql.execute("create stream ma into sta as select count(*) from ta interval(1s);") + self.expectSplitError("streamdb") + tdSql.execute("drop stream ma;") + self.expectSplitOk("streamdb") # topic tdLog.info("check forbid split having topic...") diff --git a/tests/system-test/0-others/taosdShell.py b/tests/system-test/0-others/taosdShell.py index 3d1162c370..9b0628ec12 100644 --- a/tests/system-test/0-others/taosdShell.py +++ b/tests/system-test/0-others/taosdShell.py @@ -154,7 +154,10 @@ class TDTestCase: tdSql.query("use source_db") tdSql.query("create table if not exists source_db.stb (ts timestamp, k int) tags (a int);") tdSql.query("create table source_db.ct1 using source_db.stb tags(1000);create table source_db.ct2 using source_db.stb tags(2000);create table source_db.ct3 using source_db.stb tags(3000);") - tdSql.query("create stream s1 into source_db.output_stb as select _wstart AS startts, min(k), max(k), sum(k) from source_db.stb interval(10m);") + if platform.system().lower() == 'windows': + pass + else: + tdSql.query("create stream s1 into source_db.output_stb as select _wstart AS startts, min(k), max(k), sum(k) from source_db.stb interval(10m);") #TD-19944 -Q=3 diff --git a/tests/system-test/1-insert/alter_database.py b/tests/system-test/1-insert/alter_database.py index e3ff797baa..f58bb7517e 100644 --- a/tests/system-test/1-insert/alter_database.py +++ b/tests/system-test/1-insert/alter_database.py @@ -17,7 +17,10 @@ class TDTestCase: self.replicaVar = int(replicaVar) tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor(), logSql) - self.buffer_boundary = [3, 4097, 8193, 12289, 16384] + if platform.system().lower() == 'windows': + self.buffer_boundary = [3, 4097] + else: + self.buffer_boundary = [3, 4097, 8193, 12289, 16384] # remove the value > free_memory, 70% is the weight to calculate the max value # if platform.system() == "Linux" and platform.machine() == "aarch64": # mem = psutil.virtual_memory() diff --git a/tests/system-test/1-insert/precisionNS.py b/tests/system-test/1-insert/precisionNS.py index 3de60b718a..8302f6ed28 100644 --- a/tests/system-test/1-insert/precisionNS.py +++ b/tests/system-test/1-insert/precisionNS.py @@ -14,7 +14,7 @@ import sys import random import time - +import platform import taos from util.log import * from util.cases import * @@ -149,9 +149,10 @@ class TDTestCase: tdSql.execute(sql) # create stream - sql = "create stream ma into sta as select count(ts) from st interval(100b)" - tdLog.info(sql) - tdSql.execute(sql) + if platform.system().lower() != 'windows': + sql = "create stream ma into sta as select count(ts) from st interval(100b)" + tdLog.info(sql) + tdSql.execute(sql) # insert data self.insertData() @@ -315,7 +316,8 @@ class TDTestCase: self.checkWhere() # check stream - self.checkStream() + if platform.system().lower() != 'windows': + self.checkStream() # stop def stop(self): diff --git a/tests/system-test/1-insert/precisionUS.py b/tests/system-test/1-insert/precisionUS.py index 25171ddd88..bce51dddb2 100644 --- a/tests/system-test/1-insert/precisionUS.py +++ b/tests/system-test/1-insert/precisionUS.py @@ -14,7 +14,7 @@ import sys import random import time - +import platform import taos from util.log import * from util.cases import * @@ -149,9 +149,10 @@ class TDTestCase: tdSql.execute(sql) # create stream - sql = "create stream ma into sta as select count(ts) from st interval(100u)" - tdLog.info(sql) - tdSql.execute(sql) + if platform.system().lower() != 'windows': + sql = "create stream ma into sta as select count(ts) from st interval(100u)" + tdLog.info(sql) + tdSql.execute(sql) # insert data self.insertData() @@ -289,7 +290,8 @@ class TDTestCase: self.checkWhere() # check stream - self.checkStream() + if platform.system().lower() != 'windows': + self.checkStream() # stop def stop(self): diff --git a/tests/system-test/2-query/last+last_row.py b/tests/system-test/2-query/last+last_row.py index 1ee1b4afa7..e1b4fe68dd 100644 --- a/tests/system-test/2-query/last+last_row.py +++ b/tests/system-test/2-query/last+last_row.py @@ -56,26 +56,33 @@ class TDTestCase(TDTestCase): def check_sql_result_include(self, sql,include_result): - result = os.popen("taos -s 'reset query cache; %s'" %sql) + result = os.popen(f"taos -s \"reset query cache; {sql}\"" ) res = result.read() - #tdLog.info(res) - if (include_result in res): - tdLog.info(f"check_sql_result_include : checkEqual success") - else : - tdLog.info(res) + if res is None or res == '': tdLog.info(sql) - tdLog.exit(f"check_sql_result_include : checkEqual error") + tdLog.exit(f"check_sql_result_include : taos -s return null") + else: + if (include_result in res): + tdLog.info(f"check_sql_result_include : checkEqual success") + else : + tdLog.info(res) + tdLog.info(sql) + tdLog.exit(f"check_sql_result_include : checkEqual error") def check_sql_result_not_include(self, sql,not_include_result): - result = os.popen("taos -s 'reset query cache; %s'" %sql) + result = os.popen(f"taos -s \"reset query cache; {sql}\"" ) res = result.read() #tdLog.info(res) - if (not_include_result in res): - tdLog.info(res) + if res is None or res == '': tdLog.info(sql) - tdLog.exit(f"check_sql_result_not_include : checkEqual error") - else : - tdLog.info(f"check_sql_result_not_include : checkEqual success") + tdLog.exit(f"check_sql_result_not_include : taos -s return null") + else: + if (not_include_result in res): + tdLog.info(res) + tdLog.info(sql) + tdLog.exit(f"check_sql_result_not_include : checkEqual error") + else : + tdLog.info(f"check_sql_result_not_include : checkEqual success") def cachemodel_none(self, dbname="nested"): @@ -325,6 +332,7 @@ class TDTestCase(TDTestCase): for i in range(2): self.cachemodel_none() + tdLog.info("last_row") tdSql.query("alter database nested cachemodel 'last_row' ") tdSql.query("reset query cache;") self.cachemodel_last_row() diff --git a/tests/system-test/7-tmq/tmq3mnodeSwitch.py b/tests/system-test/7-tmq/tmq3mnodeSwitch.py index 8c5dc5e693..17eed3bd5c 100644 --- a/tests/system-test/7-tmq/tmq3mnodeSwitch.py +++ b/tests/system-test/7-tmq/tmq3mnodeSwitch.py @@ -65,9 +65,12 @@ class TDTestCase: while count < self.mnodeCheckCnt: time.sleep(1) tdSql.query("select * from information_schema.ins_mnodes;") + rst = tdSql.checkRows(self.mnodes) + print(f"rst: {rst}") if tdSql.checkRows(self.mnodes) : tdLog.debug("mnode is three nodes") else: + tdSql.print_error_frame_info(tdSql.queryRows,3) tdLog.exit("mnode number is correct") roleOfMnode0 = tdSql.queryResult[0][self.roleIndex]