diff --git a/tests/python_client/chaos/testcases/test_concurrent_operation.py b/tests/python_client/chaos/testcases/test_concurrent_operation.py index 19fe910afe..62ce7ffc14 100644 --- a/tests/python_client/chaos/testcases/test_concurrent_operation.py +++ b/tests/python_client/chaos/testcases/test_concurrent_operation.py @@ -14,6 +14,7 @@ from common.cus_resource_opts import CustomResourceOperations as CusResource from utils.util_log import test_log as log from chaos import chaos_commons as cc from common import common_func as cf +from chaos.chaos_commons import assert_statistic from common.common_type import CaseLabel from chaos import constants from delayed_assert import expect, assert_expectations @@ -97,7 +98,7 @@ class TestOperations(TestBase): yield request.param @pytest.mark.tags(CaseLabel.L3) - def test_operations(self): + def test_operations(self, request_duration, is_check): # start the monitor threads to check the milvus ops log.info("*********************Test Start**********************") log.info(connections.get_connection_addr('default')) @@ -106,10 +107,13 @@ class TestOperations(TestBase): cc.start_monitor_threads(self.health_checkers) log.info("*********************Load Start**********************") # wait 200s - + request_duration = eval(request_duration.replace("h","*3600+").replace("m","*60+").replace("s","")) for i in range(10): - sleep(20) + sleep(request_duration//10) for k,v in self.health_checkers.items(): v.check_result() # log.info(v.check_result()) + if is_check: + assert_statistic(self.health_checkers) + assert_expectations() log.info("*********************Chaos Test Completed**********************") diff --git a/tests/python_client/chaos/testcases/test_single_request_operation.py b/tests/python_client/chaos/testcases/test_single_request_operation.py index c90c0dee16..f2d79bff60 100644 --- a/tests/python_client/chaos/testcases/test_single_request_operation.py +++ b/tests/python_client/chaos/testcases/test_single_request_operation.py @@ -11,8 +11,9 @@ from chaos.checker import (InsertChecker, from utils.util_log import test_log as log from chaos import chaos_commons as cc from common.common_type import CaseLabel +from chaos.chaos_commons import assert_statistic from chaos import constants - +from delayed_assert import assert_expectations class TestBase: expect_create = constants.SUCC @@ -57,7 +58,7 @@ class TestOperations(TestBase): self.health_checkers = checkers @pytest.mark.tags(CaseLabel.L3) - def test_operations(self): + def test_operations(self, request_duration, is_check): # start the monitor threads to check the milvus ops log.info("*********************Test Start**********************") log.info(connections.get_connection_addr('default')) @@ -66,9 +67,12 @@ class TestOperations(TestBase): cc.start_monitor_threads(self.health_checkers) log.info("*********************Load Start**********************") # wait 200s - + request_duration = eval(request_duration.replace("h","*3600+").replace("m","*60+").replace("s","")) for i in range(10): - sleep(20) + sleep(request_duration//10) for k,v in self.health_checkers.items(): v.check_result() + if is_check: + assert_statistic(self.health_checkers) + assert_expectations() log.info("*********************Chaos Test Completed**********************") diff --git a/tests/python_client/chaos/testcases/test_verify_all_collections.py b/tests/python_client/chaos/testcases/test_verify_all_collections.py index 805c305f43..e07d067b36 100644 --- a/tests/python_client/chaos/testcases/test_verify_all_collections.py +++ b/tests/python_client/chaos/testcases/test_verify_all_collections.py @@ -82,7 +82,7 @@ class TestOperations(TestBase): self.health_checkers = checkers @pytest.mark.tags(CaseLabel.L3) - def test_operations(self,collection_name): + def test_operations(self,collection_name, request_duration): # start the monitor threads to check the milvus ops log.info("*********************Test Start**********************") log.info(connections.get_connection_addr('default')) @@ -90,9 +90,10 @@ class TestOperations(TestBase): self.init_health_checkers(collection_name=c_name) cc.start_monitor_threads(self.health_checkers) log.info("*********************Request Load Start**********************") + request_duration = eval(request_duration.replace("h","*3600+").replace("m","*60+").replace("s","")) # wait 200s for the load request to be finished for i in range(10): - sleep(20) + sleep(request_duration//10) for k,v in self.health_checkers.items(): v.check_result() log.info("******assert after chaos deleted: ")