diff --git a/tests/python_client/chaos/scripts/hello_milvus.py b/tests/python_client/chaos/scripts/hello_milvus.py index 0b8ef18301..1d74672f5b 100644 --- a/tests/python_client/chaos/scripts/hello_milvus.py +++ b/tests/python_client/chaos/scripts/hello_milvus.py @@ -74,9 +74,17 @@ def hello_milvus(host="127.0.0.1"): collection.create_index(field_name="float_vector", index_params=default_index) t1 = time.time() print(f"\nCreate index cost {t1 - t0:.4f} seconds") + print("\nGet replicas number") + try: + replicas_info = collection.get_replicas() + replica_number = len(replicas_info.groups) + print(f"\nReplicas number is {replica_number}") + except Exception as e: + print(str(e)) + replica_number = 1 print(f"\nload collection...") t0 = time.time() - collection.load() + collection.load(replica_number=replica_number) t1 = time.time() print(f"\nload collection cost {t1 - t0:.4f} seconds") @@ -105,7 +113,6 @@ def hello_milvus(host="127.0.0.1"): sorted_res = sorted(res, key=lambda k: k['int64']) for r in sorted_res: print(r) - # collection.release() parser = argparse.ArgumentParser(description='host ip') diff --git a/tests/python_client/chaos/scripts/verify_all_collections.py b/tests/python_client/chaos/scripts/verify_all_collections.py index 1d3c125001..6895d99a95 100644 --- a/tests/python_client/chaos/scripts/verify_all_collections.py +++ b/tests/python_client/chaos/scripts/verify_all_collections.py @@ -69,9 +69,17 @@ def hello_milvus(collection_name): collection.create_index(field_name="float_vector", index_params=default_index) t1 = time.time() print(f"\nCreate index cost {t1 - t0:.4f} seconds") + print("\nGet replicas number") + try: + replicas_info = collection.get_replicas() + replica_number = len(replicas_info.groups) + print(f"\nReplicas number is {replica_number}") + except Exception as e: + print(str(e)) + replica_number = 1 print(f"\nload collection...") t0 = time.time() - collection.load() + collection.load(replica_number=replica_number) t1 = time.time() print(f"\nload collection cost {t1 - t0:.4f} seconds") @@ -100,11 +108,10 @@ def hello_milvus(collection_name): sorted_res = sorted(res, key=lambda k: k['int64']) for r in sorted_res: print(r) - collection.release() parser = argparse.ArgumentParser(description='host ip') -parser.add_argument('--host', type=str, default='10.96.77.209', help='host ip') +parser.add_argument('--host', type=str, default='127.0.0.1', help='host ip') args = parser.parse_args() # add time stamp print(f"\nStart time: {time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))}") diff --git a/tests/python_client/chaos/test_chaos_multi_replicas.py b/tests/python_client/chaos/test_chaos_multi_replicas.py index eb5b89d391..47b0399e04 100644 --- a/tests/python_client/chaos/test_chaos_multi_replicas.py +++ b/tests/python_client/chaos/test_chaos_multi_replicas.py @@ -86,7 +86,7 @@ class TestChaos(TestChaosBase): @pytest.fixture(scope="function", autouse=True) def init_health_checkers(self): - c_name = cf.gen_unique_str('Checker_') + c_name = cf.gen_unique_str('MultiReplicasChecker_') replicas_num = 2 shards_num = 2 checkers = {