diff --git a/tests/python_client/chaos/test_chaos.py b/tests/python_client/chaos/test_chaos.py index 733c6f71b7..9f2716c5fa 100644 --- a/tests/python_client/chaos/test_chaos.py +++ b/tests/python_client/chaos/test_chaos.py @@ -5,6 +5,7 @@ from pymilvus import connections from chaos.checker import (CreateChecker, InsertFlushChecker, SearchChecker, QueryChecker, IndexChecker, Op) from common.cus_resource_opts import CustomResourceOperations as CusResource +from common.milvus_sys import MilvusSys from utils.util_log import test_log as log from chaos import chaos_commons as cc from common.common_type import CaseLabel @@ -44,10 +45,20 @@ class TestChaosBase: tests_yaml = constants.TESTS_CONFIG_LOCATION + 'testcases.yaml' tests_config = cc.gen_experiment_config(tests_yaml) test_collections = tests_config.get('Collections', None) + ms = MilvusSys(alias="default") + node_map = { + "querynode": "query_nodes", + "datanode": "data_nodes", + "indexnode": "index_nodes" + } for t in test_collections: test_chaos = t.get('testcase', {}).get('chaos', {}) if test_chaos in chaos_yaml: expects = t.get('testcase', {}).get('expectation', {}).get('cluster_1_node', {}) + # for cluster_n_node mode + for node in node_map.keys(): + if node in test_chaos and len(getattr(ms, node_map[node])) > 1: + expects = t.get('testcase', {}).get('expectation', {}).get('cluster_n_node', {}) log.info(f"yaml.expects: {expects}") self.expect_create = expects.get(Op.create.value, constants.SUCC) self.expect_insert = expects.get(Op.insert.value, constants.SUCC)