From cdee149191d08d3e5615b46b9fc79bb91de7639e Mon Sep 17 00:00:00 2001 From: zhuwenxing Date: Mon, 28 Oct 2024 10:33:29 +0800 Subject: [PATCH] test: fix testcases for verification after chaos (#37153) /kind improvement Signed-off-by: zhuwenxing --- .../chaos/testcases/test_all_collections_after_chaos.py | 4 ++-- .../chaos/testcases/test_concurrent_operation.py | 2 +- tests/python_client/common/common_func.py | 5 ++++- tests/python_client/requirements.txt | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/python_client/chaos/testcases/test_all_collections_after_chaos.py b/tests/python_client/chaos/testcases/test_all_collections_after_chaos.py index 7b5b76a7f6..442270e0c0 100644 --- a/tests/python_client/chaos/testcases/test_all_collections_after_chaos.py +++ b/tests/python_client/chaos/testcases/test_all_collections_after_chaos.py @@ -50,7 +50,7 @@ class TestAllCollection(TestcaseBase): # insert offset = -3000 - data = cf.get_column_data_by_schema(nb=ct.default_nb, schema=schema, start=offset) + data = cf.gen_row_data_by_schema(nb=ct.default_nb, schema=schema, start=offset) t0 = time.time() _, res = collection_w.insert(data) tt = time.time() - t0 @@ -108,7 +108,7 @@ class TestAllCollection(TestcaseBase): collection_w.release() # insert data - d = cf.get_column_data_by_schema(nb=ct.default_nb, schema=schema) + d = cf.gen_row_data_by_schema(nb=ct.default_nb, schema=schema) collection_w.insert(d) # load diff --git a/tests/python_client/chaos/testcases/test_concurrent_operation.py b/tests/python_client/chaos/testcases/test_concurrent_operation.py index 1296573baa..5daddd6e36 100644 --- a/tests/python_client/chaos/testcases/test_concurrent_operation.py +++ b/tests/python_client/chaos/testcases/test_concurrent_operation.py @@ -28,7 +28,7 @@ from delayed_assert import assert_expectations def get_all_collections(): try: - with open("/tmp/ci_logs/all_collections.json", "r") as f: + with open("/tmp/ci_logs/chaos_test_all_collections.json", "r") as f: data = json.load(f) all_collections = data["all"] except Exception as e: diff --git a/tests/python_client/common/common_func.py b/tests/python_client/common/common_func.py index b4776cdaf6..fead3dd43c 100644 --- a/tests/python_client/common/common_func.py +++ b/tests/python_client/common/common_func.py @@ -1664,7 +1664,7 @@ def get_column_data_by_schema(nb=ct.default_nb, schema=None, skip_vectors=False, return data -def gen_row_data_by_schema(nb=ct.default_nb, schema=None): +def gen_row_data_by_schema(nb=ct.default_nb, schema=None, start=None): if schema is None: schema = gen_default_collection_schema() # ignore auto id field and the fields in function output @@ -1688,6 +1688,9 @@ def gen_row_data_by_schema(nb=ct.default_nb, schema=None): tmp = {} for field in fields_needs_data: tmp[field.name] = gen_data_by_collection_field(field) + if start is not None and field.dtype == DataType.INT64: + tmp[field.name] = start + start += 1 data.append(tmp) return data diff --git a/tests/python_client/requirements.txt b/tests/python_client/requirements.txt index 88173c7135..d1a602225c 100644 --- a/tests/python_client/requirements.txt +++ b/tests/python_client/requirements.txt @@ -27,8 +27,8 @@ pytest-parallel pytest-random-order # pymilvus -pymilvus==2.5.0rc103 -pymilvus[bulk_writer]==2.5.0rc103 +pymilvus==2.5.0rc104 +pymilvus[bulk_writer]==2.5.0rc104 # for customize config test python-benedict==0.24.3