From e7b4fbcf90c7de8f6350647557d6f3c95fabd960 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Wed, 30 Oct 2024 21:33:54 +0800 Subject: [PATCH] test:add checking stream status and set interval 8 to test --- tests/pytest/util/common.py | 19 ++++++----- .../8-stream/force_window_close_interval.py | 32 +++++++++++++------ 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py index 5827f0757f..c12f324fd7 100644 --- a/tests/pytest/util/common.py +++ b/tests/pytest/util/common.py @@ -1012,7 +1012,7 @@ class TDCom: # If no match was found, or the pattern does not match the expected format, return False return False - def check_stream_task_status(self, stream_name, vgroups, stream_timeout=None): + def check_stream_task_status(self, stream_name, vgroups, stream_timeout=0, check_wal_info=True): """check stream status Args: @@ -1048,13 +1048,16 @@ class TDCom: print(f"result_task_status:{result_task_status},result_task_history:{result_task_history},result_task_alll:{result_task_alll}") if result_task_status_rows == 1 and result_task_status ==[('ready',)] : if result_task_history_rows == 1 and result_task_history == [(None,)] : - for vgroup_num in range(vgroups): - if self.check_stream_wal_info(result_task_alll[vgroup_num][4]) : - check_stream_success += 1 - tdLog.info(f"check stream task list[{check_stream_success}] sucessfully :") - else: - check_stream_success = 0 - break + if check_wal_info: + for vgroup_num in range(vgroups): + if self.check_stream_wal_info(result_task_alll[vgroup_num][4]) : + check_stream_success += 1 + tdLog.info(f"check stream task list[{check_stream_success}] sucessfully :") + else: + check_stream_success = 0 + break + else: + check_stream_success = vgroups if check_stream_success == vgroups: break diff --git a/tests/system-test/8-stream/force_window_close_interval.py b/tests/system-test/8-stream/force_window_close_interval.py index a93e79f991..88b1628b25 100644 --- a/tests/system-test/8-stream/force_window_close_interval.py +++ b/tests/system-test/8-stream/force_window_close_interval.py @@ -126,7 +126,7 @@ class TDTestCase: partition_elm = "" if fill_value: if "value" in fill_value.lower(): - fill_value = "VALUE,1,2,3,4,5,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11" + fill_value = "VALUE,1" # create error stream tdLog.info("create error stream") @@ -256,7 +256,7 @@ class TDTestCase: if fill_value: if "value" in fill_value.lower(): - fill_value = "VALUE,1,2,3,4,5,6,7,8,9,10,11" + fill_value = "VALUE,1" # create stream general table tdLog.info("create stream general table") @@ -271,8 +271,15 @@ class TDTestCase: ignore_update=ignore_update, ) - #sleep 10s wait stream_task status is ready - time.sleep(10) + # wait and check stream_task status is ready + time.sleep(self.tdCom.dataDict["interval"]) + tdSql.query("show streams") + tdLog.info(f"tdSql.queryResult:{tdSql.queryResult},tdSql.queryRows:{tdSql.queryRows}") + for stream_number in range(tdSql.queryRows): + stream_name = tdSql.queryResult[stream_number][0] + tdCom.check_stream_task_status( + stream_name=stream_name, vgroups=2, stream_timeout=20,check_wal_info=False + ) # insert data self.tdCom.date_time = self.tdCom.genTs(precision=self.tdCom.precision)[0] @@ -487,8 +494,6 @@ class TDTestCase: ) start_new_ts = tdSql.getData(0, 1) if tbname == self.ctb_name: - if "value" in fill_value.lower(): - fill_value = "VALUE,1,2,3,6,7,8,9,10,11,1,2,3,4,5,6,7,8,9,10,11" if partition == "tbname": # check data for child table tdLog.info("check data for child table ") @@ -536,8 +541,6 @@ class TDTestCase: fill_value=fill_value, ) else: - if "value" in fill_value.lower(): - fill_value = "VALUE,1" if partition == "tbname": # check data for general table self.tdCom.check_query_data( @@ -618,8 +621,18 @@ class TDTestCase: ) def run(self): + for fill_value in ["PREV", "NEXT", "VALUE"]: + self.force_window_close( + interval=10, + partition="tbname", + funciton_name="interp(c1)", + funciton_name_alias="intp_c1", + delete=False, + ignore_update=1, + fill_value=fill_value, + ) self.force_window_close( - interval=10, + interval=8, partition="tbname", funciton_name="interp(c1)", funciton_name_alias="intp_c1", @@ -644,5 +657,6 @@ class TDTestCase: event = threading.Event() + tdCases.addLinux(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase())