From f55ca5eb56d48a5902c5f9acdc3203c6cb5ea872 Mon Sep 17 00:00:00 2001 From: zhuwenxing Date: Mon, 27 Jun 2022 16:36:16 +0800 Subject: [PATCH] [skip e2e]Update multi replicas chaos (#17831) Signed-off-by: zhuwenxing --- tests/python_client/chaos/test_chaos_multi_replicas.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/python_client/chaos/test_chaos_multi_replicas.py b/tests/python_client/chaos/test_chaos_multi_replicas.py index ac76d7c25cd8b..eb5b89d3917f6 100644 --- a/tests/python_client/chaos/test_chaos_multi_replicas.py +++ b/tests/python_client/chaos/test_chaos_multi_replicas.py @@ -12,7 +12,7 @@ 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 utils.util_k8s import wait_pods_ready, get_pod_ip_name_pairs +from utils.util_k8s import wait_pods_ready, get_pod_ip_name_pairs, get_milvus_instance_name from chaos import chaos_commons as cc from common.common_type import CaseLabel from common import common_func as cf @@ -82,6 +82,7 @@ def connection(self, host, port): raise Exception("no connections") self.host = host self.port = port + self.instance_name = get_milvus_instance_name(constants.CHAOS_NAMESPACE, host) @pytest.fixture(scope="function", autouse=True) def init_health_checkers(self): @@ -113,13 +114,15 @@ def teardown(self): def test_multi_replicas_with_only_one_group_available(self, chaos_type, failed_node_type, failed_group_scope, is_streaming): # start the monitor threads to check the milvus ops log.info("*********************Chaos Test Start**********************") + log.info("Test config") + log.info(cc.gen_experiment_config(config_file_name)) # log.info(f"chaos_yaml: {chaos_yaml}") log.info(connections.get_connection_addr('default')) if is_streaming is False: del self.health_checkers[Op.insert] cc.start_monitor_threads(self.health_checkers) # get replicas info - release_name = "milvus-multi-querynode" + release_name = self.instance_name querynode_id_pod_pair = get_querynode_info(release_name) log.info(querynode_id_pod_pair) group_list = [] @@ -146,6 +149,9 @@ def test_multi_replicas_with_only_one_group_available(self, chaos_type, failed_n target_nodes = list(set(g) & set(shard_leader_list)) if failed_node_type == "non_shard_leader": target_nodes = list(set(g) - set(shard_leader_list)) + if len(target_nodes) == 0: + log.info("there is no node satisfied, chose one randomly") + target_nodes = [random.choice(g)] for target_node in target_nodes: pod = querynode_id_pod_pair[target_node] target_pod_list.append(pod)