From c827f4b9488a582978599b5205ac2fb698c9059c Mon Sep 17 00:00:00 2001 From: nico <109071306+NicoYuan1986@users.noreply.github.com> Date: Tue, 3 Jun 2025 14:16:32 +0800 Subject: [PATCH] test: update sdk version and cases (#42077) Signed-off-by: nico --- tests/python_client/check/func_check.py | 1 - .../test_milvus_client_collection.py | 8 ++++---- .../test_milvus_client_database.py | 8 +++----- .../milvus_client/test_milvus_client_query.py | 2 +- .../test_milvus_client_e2e.py | 20 ++++++++++--------- .../testcases/test_collection.py | 6 ++---- 6 files changed, 21 insertions(+), 24 deletions(-) diff --git a/tests/python_client/check/func_check.py b/tests/python_client/check/func_check.py index 766cc95f0c..cbfed6b30c 100644 --- a/tests/python_client/check/func_check.py +++ b/tests/python_client/check/func_check.py @@ -281,7 +281,6 @@ class ResponseChecker: assert dim_list[0] == dim_list_expected else: assert dim_list == dim_list_expected - assert res["fields"][1]["params"]["dim"] == check_items.get("dim") if check_items.get("nullable_fields", None) is not None: nullable_fields = check_items.get("nullable_fields") if not isinstance(nullable_fields, list): diff --git a/tests/python_client/milvus_client/test_milvus_client_collection.py b/tests/python_client/milvus_client/test_milvus_client_collection.py index ed779b56ab..1f733e6ee9 100644 --- a/tests/python_client/milvus_client/test_milvus_client_collection.py +++ b/tests/python_client/milvus_client/test_milvus_client_collection.py @@ -333,9 +333,9 @@ class TestMilvusClientCollectionValid(TestMilvusClientV2Base): schema = self.create_schema(client, enable_dynamic_field=False)[0] schema.add_field("id_int64", DataType.INT64, is_primary=True, auto_id=False) schema.add_field("embeddings", DataType.FLOAT_VECTOR, dim=dim) - schema.add_field("int8embeddings_1", DataType.INT8_VECTOR, dim=dim * 2) - schema.add_field("int8embeddings_2", DataType.FLOAT16_VECTOR, dim=int(dim / 2)) - schema.add_field("int8embeddings_3", DataType.BFLOAT16_VECTOR, dim=int(dim / 2)) + schema.add_field("embeddings_1", DataType.INT8_VECTOR, dim=dim * 2) + schema.add_field("embeddings_2", DataType.FLOAT16_VECTOR, dim=int(dim / 2)) + schema.add_field("embeddings_3", DataType.BFLOAT16_VECTOR, dim=int(dim / 2)) index_params = self.prepare_index_params(client)[0] index_params.add_index("embeddings", metric_type="COSINE") index_params.add_index("embeddings_1", metric_type="IP") @@ -346,7 +346,7 @@ class TestMilvusClientCollectionValid(TestMilvusClientV2Base): collections = self.list_collections(client)[0] assert collection_name in collections check_items = {"collection_name": collection_name, - "dim": [dim, dim * 2, dim / 2, dim / 2], + "dim": [dim, dim * 2, int(dim / 2), int(dim / 2)], "consistency_level": 0, "enable_dynamic_field": False, "id_name": "id_int64", diff --git a/tests/python_client/milvus_client/test_milvus_client_database.py b/tests/python_client/milvus_client/test_milvus_client_database.py index a9af90988b..2999ac61a7 100644 --- a/tests/python_client/milvus_client/test_milvus_client_database.py +++ b/tests/python_client/milvus_client/test_milvus_client_database.py @@ -189,7 +189,7 @@ class TestMilvusClientDatabaseInvalid(TestMilvusClientV2Base): self.create_collection(client, collection_name, default_dim) collections = self.list_collections(client)[0] assert collection_name in collections - #3. drop database + # 3. drop database error = {ct.err_code: 65535, ct.err_msg: f"{db_name} not empty, must drop all collections before drop database"} self.drop_database(client, db_name, check_task=CheckTasks.err_res, check_items=error) @@ -205,10 +205,8 @@ class TestMilvusClientDatabaseInvalid(TestMilvusClientV2Base): expected: raise exception """ client = self._client() - error = {ct.err_code: 1, ct.err_msg: f"Unexpected error, message= value AND varchar field is not null complex_mix_filter1 = "int32_field is null and float_field > 10.0 and varchar_field is not null" complex_mix_expected1 = [r for r in total_rows if r["int32_field"] is None and - r["float_field"] is not None and r["float_field"] > 10.0 and - r["varchar_field"] is not None] + r["float_field"] is not None and r["float_field"] > 10.0 and + r["varchar_field"] is not None] query_res, _ = self.query( client, collection_name, @@ -542,8 +543,8 @@ class TestMilvusClientE2E(TestMilvusClientV2Base): # Test case 2: varchar field is not null AND int field between values AND float field is null complex_mix_filter2 = "varchar_field is not null and 5 <= int64_field <= 15 and float_field is null" complex_mix_expected2 = [r for r in total_rows if r["varchar_field"] is not None and - r["int64_field"] is not None and 5 <= r["int64_field"] <= 15 and - r["float_field"] is None] + r["int64_field"] is not None and 5 <= r["int64_field"] <= 15 and + r["float_field"] is None] query_res, _ = self.query( client, collection_name, @@ -558,10 +559,11 @@ class TestMilvusClientE2E(TestMilvusClientV2Base): ) # Test case 3: Multiple fields with mixed null/not null conditions and range comparisons - complex_mix_filter3 = "int8_field is not null and int8_field < 50 and double_field is null and varchar_field is not null and varchar_field like \"varchar_2%\"" + complex_mix_filter3 = ("int8_field is not null and int8_field < 50 and double_field is null and " + "varchar_field is not null and varchar_field like \"varchar_2%\"") complex_mix_expected3 = [r for r in total_rows if r["int8_field"] is not None and r["int8_field"] < 50 and - r["double_field"] is None and - r["varchar_field"] is not None and r["varchar_field"].startswith("varchar_2")] + r["double_field"] is None and + r["varchar_field"] is not None and r["varchar_field"].startswith("varchar_2")] query_res, _ = self.query( client, collection_name, @@ -595,4 +597,4 @@ class TestMilvusClientE2E(TestMilvusClientV2Base): # 8. Cleanup self.release_collection(client, collection_name) - self.drop_collection(client, collection_name) \ No newline at end of file + self.drop_collection(client, collection_name) diff --git a/tests/python_client/testcases/test_collection.py b/tests/python_client/testcases/test_collection.py index 4f22cc5b03..f2ad153cb3 100644 --- a/tests/python_client/testcases/test_collection.py +++ b/tests/python_client/testcases/test_collection.py @@ -2785,10 +2785,7 @@ class TestLoadCollection(TestcaseBase): assert collection_w.num_entities == ct.default_nb collection_w.create_index(ct.default_float_vec_field_name, index_params=ct.default_flat_index) - collection_w.load(replica_number=replicas, - check_task=CheckTasks.err_res, - check_items={"err_code": 1, - "err_msg": "`replica_number` value None is illegal"}) + collection_w.load(replica_number=replicas) @pytest.mark.tags(CaseLabel.L2) def test_load_replica_greater_than_querynodes(self): @@ -3147,6 +3144,7 @@ class TestDescribeCollection(TestcaseBase): assert isinstance(res['collection_id'], int) and isinstance(res['created_timestamp'], int) del res['collection_id'] del res['created_timestamp'] + del res['update_timestamp'] log.info(res) assert description == res