From 49b69e7c7843dd3fd9f8845fea607dc67125b9c6 Mon Sep 17 00:00:00 2001 From: nico Date: Thu, 23 Jan 2025 17:13:08 +0800 Subject: [PATCH] test: update test cases and sdk version[2.4] Signed-off-by: nico --- tests/python_client/conftest.py | 4 ++-- .../milvus_client/test_milvus_client_partition.py | 7 ++++--- tests/python_client/requirements.txt | 4 ++-- .../testcases/async_milvus_client/test_e2e_async.py | 7 ++++--- tests/python_client/testcases/test_index.py | 2 +- tests/python_client/testcases/test_insert.py | 2 ++ tests/python_client/testcases/test_partition.py | 2 ++ tests/python_client/testcases/test_utility.py | 4 ++++ tests/python_client/utils/util_pymilvus.py | 2 +- 9 files changed, 22 insertions(+), 12 deletions(-) diff --git a/tests/python_client/conftest.py b/tests/python_client/conftest.py index 62a9e4458871f..fb8e7a65bd51e 100644 --- a/tests/python_client/conftest.py +++ b/tests/python_client/conftest.py @@ -333,7 +333,7 @@ def check_server_connection(request): # yield -@pytest.fixture(scope="module") +# @pytest.fixture(scope="module") def connect(request): host = request.config.getoption("--host") service_name = request.config.getoption("--service") @@ -360,7 +360,7 @@ def fin(): return milvus -@pytest.fixture(scope="module") +# @pytest.fixture(scope="module") def dis_connect(request): host = request.config.getoption("--host") service_name = request.config.getoption("--service") diff --git a/tests/python_client/milvus_client/test_milvus_client_partition.py b/tests/python_client/milvus_client/test_milvus_client_partition.py index 1a5368014b18d..a7b931f6c6a7d 100644 --- a/tests/python_client/milvus_client/test_milvus_client_partition.py +++ b/tests/python_client/milvus_client/test_milvus_client_partition.py @@ -552,9 +552,10 @@ def test_milvus_client_release_partition_name_lists_not_all_exists(self): client_w.create_collection(client, collection_name, default_dim) error = {ct.err_code: 1, ct.err_msg: f"partition not found[partition={not_exist_partition}]"} client_w.release_partitions(client, collection_name, partition_names, - check_task=CheckTasks.err_res, check_items=error) + check_task=CheckTasks.err_res, check_items=error) @pytest.mark.tags(CaseLabel.L2) + @pytest.mark.skip("https://github.com/milvus-io/milvus/issues/38223") def test_milvus_client_release_not_exist_partition_name(self): """ target: test fast release partition -- invalid partition name type @@ -714,7 +715,7 @@ def test_milvus_client_list_partitions_invalid_collection_name(self, collection_ error = {ct.err_code: 1100, ct.err_msg: f"Invalid collection name: {collection_name}. the first character of a " f"collection name must be an underscore or letter: invalid parameter"} client_w.list_partitions(client, collection_name, - check_task=CheckTasks.err_res, check_items=error) + check_task=CheckTasks.err_res, check_items=error) @pytest.mark.tags(CaseLabel.L1) def test_milvus_client_list_partitions_collection_name_over_max_length(self): @@ -729,7 +730,7 @@ def test_milvus_client_list_partitions_collection_name_over_max_length(self): error = {ct.err_code: 1100, ct.err_msg: f"Invalid collection name: {collection_name}. the length of a collection name " f"must be less than 255 characters: invalid parameter"} client_w.list_partitions(client, collection_name, - check_task=CheckTasks.err_res, check_items=error) + check_task=CheckTasks.err_res, check_items=error) @pytest.mark.tags(CaseLabel.L1) def test_milvus_client_list_partitions_not_exist_collection_name(self): diff --git a/tests/python_client/requirements.txt b/tests/python_client/requirements.txt index c447857cc096d..d7053da5afcbe 100644 --- a/tests/python_client/requirements.txt +++ b/tests/python_client/requirements.txt @@ -13,8 +13,8 @@ allure-pytest==2.7.0 pytest-print==0.2.1 pytest-level==0.1.1 pytest-xdist==2.5.0 -pymilvus==2.4.13rc2 -pymilvus[bulk_writer]==2.4.13rc2 +pymilvus==2.4.14 +pymilvus[bulk_writer]==2.4.14 pytest-rerunfailures==9.1.1 git+https://github.com/Projectplace/pytest-tags ndg-httpsclient diff --git a/tests/python_client/testcases/async_milvus_client/test_e2e_async.py b/tests/python_client/testcases/async_milvus_client/test_e2e_async.py index d82ae10339627..9ca6078ffc981 100644 --- a/tests/python_client/testcases/async_milvus_client/test_e2e_async.py +++ b/tests/python_client/testcases/async_milvus_client/test_e2e_async.py @@ -217,6 +217,7 @@ async def test_async_client_partition(self): @pytest.mark.tags(CaseLabel.L0) async def test_async_client_with_schema(self, schema): # init client + pk_field_name = "id" milvus_client = self._connect(enable_milvus_client_api=True) self.init_async_milvus_client() @@ -224,7 +225,7 @@ async def test_async_client_with_schema(self, schema): c_name = cf.gen_unique_str(prefix) schema = self.async_milvus_client_wrap.create_schema(auto_id=False, partition_key_field=ct.default_int64_field_name) - schema.add_field(ct.default_string_field_name, DataType.VARCHAR, max_length=100, is_primary=True) + schema.add_field(pk_field_name, DataType.VARCHAR, max_length=100, is_primary=True) schema.add_field(ct.default_int64_field_name, DataType.INT64, is_partition_key=True) schema.add_field(ct.default_float_vec_field_name, DataType.FLOAT_VECTOR, dim=ct.default_dim) schema.add_field(default_vector_name, DataType.FLOAT_VECTOR, dim=ct.default_dim) @@ -234,7 +235,7 @@ async def test_async_client_with_schema(self, schema): # insert entities rows = [ - {ct.default_string_field_name: str(i), + {pk_field_name: str(i), ct.default_int64_field_name: i, ct.default_float_vec_field_name: [random.random() for _ in range(ct.default_dim)], default_vector_name: [random.random() for _ in range(ct.default_dim)], @@ -314,7 +315,7 @@ async def test_async_client_with_schema(self, schema): # get with ids get_task = self.async_milvus_client_wrap.get(c_name, ids=['0', '1'], output_fields=[ct.default_int64_field_name, - ct.default_string_field_name]) + pk_field_name]) tasks.append(get_task) await asyncio.gather(*tasks) diff --git a/tests/python_client/testcases/test_index.py b/tests/python_client/testcases/test_index.py index d13a3c344f136..658116957b1c7 100644 --- a/tests/python_client/testcases/test_index.py +++ b/tests/python_client/testcases/test_index.py @@ -1193,7 +1193,7 @@ def invalid_index_name(self, request): yield request.param @pytest.mark.tags(CaseLabel.L0) - def test_index_with_invalid_index_name(self, connect, invalid_index_name): + def test_index_with_invalid_index_name(self, invalid_index_name): """ target: test create index interface for invalid scenario method: diff --git a/tests/python_client/testcases/test_insert.py b/tests/python_client/testcases/test_insert.py index cee34f7d80c33..007c54cb7f927 100644 --- a/tests/python_client/testcases/test_insert.py +++ b/tests/python_client/testcases/test_insert.py @@ -2073,6 +2073,8 @@ def test_upsert_partition_name_non_existing(self, partition_name): cf.insert_data(collection_w) data = cf.gen_default_dataframe_data(nb=100) error = {ct.err_code: 999, ct.err_msg: "Invalid partition name"} + if partition_name == "n-ame": + error = {ct.err_code: 999, ct.err_msg: f"partition not found[partition={partition_name}]"} collection_w.upsert(data=data, partition_name=partition_name, check_task=CheckTasks.err_res, check_items=error) diff --git a/tests/python_client/testcases/test_partition.py b/tests/python_client/testcases/test_partition.py index 5bba53b05bc8d..f16e109f01df7 100644 --- a/tests/python_client/testcases/test_partition.py +++ b/tests/python_client/testcases/test_partition.py @@ -208,6 +208,8 @@ def test_partition_invalid_name(self, partition_name): """ if partition_name == "12name": pytest.skip(reason="won't fix issue #32998") + if partition_name == "n-ame": + pytest.skip(reason="https://github.com/milvus-io/milvus/issues/39432") # create collection collection_w = self.init_collection_wrap() diff --git a/tests/python_client/testcases/test_utility.py b/tests/python_client/testcases/test_utility.py index ee578b0d8efeb..a4070738c4d64 100644 --- a/tests/python_client/testcases/test_utility.py +++ b/tests/python_client/testcases/test_utility.py @@ -144,6 +144,8 @@ def test_has_partition_name_value_invalid(self, get_invalid_value_collection_nam p_name = get_invalid_value_collection_name if p_name == "12name": pytest.skip("partition name 12name is legal") + if p_name == "n-ame": + pytest.skip("https://github.com/milvus-io/milvus/issues/39432") error = {ct.err_code: 999, ct.err_msg: f"Invalid partition name: {p_name}"} if p_name in [None]: error = {ct.err_code: 999, ct.err_msg: f"`partition_name` value {p_name} is illegal"} @@ -287,6 +289,8 @@ def test_loading_progress_invalid_partition_names(self, partition_name): method: input invalid partition names expected: raise an exception """ + if partition_name == "": + pytest.skip("https://github.com/milvus-io/milvus/issues/38223") collection_w = self.init_collection_general(prefix, nb=10)[0] partition_names = [partition_name] collection_w.load() diff --git a/tests/python_client/utils/util_pymilvus.py b/tests/python_client/utils/util_pymilvus.py index 7f334d7fb5544..ea4ca4a755abe 100644 --- a/tests/python_client/utils/util_pymilvus.py +++ b/tests/python_client/utils/util_pymilvus.py @@ -8,7 +8,7 @@ import numpy as np import requests from sklearn import preprocessing -from pymilvus import Milvus, DataType +from pymilvus import DataType from utils.util_log import test_log as log from utils.util_k8s import init_k8s_client_config