Skip to content

Commit

Permalink
test: update test cases (#37660)
Browse files Browse the repository at this point in the history
Signed-off-by: nico <[email protected]>
  • Loading branch information
NicoYuan1986 authored Nov 14, 2024
1 parent 993051b commit 405c12f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
17 changes: 7 additions & 10 deletions tests/python_client/milvus_client/test_milvus_client_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,11 +813,11 @@ def test_milvus_client_load_collection_over_max_length(self):
"""
client = self._connect(enable_milvus_client_api=True)
collection_name = "a".join("a" for i in range(256))
error = {ct.err_code: 1100, ct.err_msg: f"invalid dimension: {collection_name}. "
error = {ct.err_code: 1100, ct.err_msg: f"Invalid collection name: {collection_name}. "
f"the length of a collection name must be less than 255 characters: "
f"invalid parameter"}
client_w.load_collection(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_load_collection_without_index(self):
Expand Down Expand Up @@ -929,8 +929,7 @@ def test_milvus_client_describe_collection_not_existed(self):
"""
client = self._connect(enable_milvus_client_api=True)
collection_name = "nonexisted"
error = {ct.err_code: 100, ct.err_msg: f"can't find collection collection not "
f"found[database=default][collection=nonexisted]"}
error = {ct.err_code: 100, ct.err_msg: "can't find collection[database=default][collection=nonexisted]"}
client_w.describe_collection(client, collection_name,
check_task=CheckTasks.err_res, check_items=error)

Expand All @@ -946,8 +945,7 @@ def test_milvus_client_describe_collection_deleted_collection(self):
# 1. create collection
client_w.create_collection(client, collection_name, default_dim)
client_w.drop_collection(client, collection_name)
error = {ct.err_code: 100, ct.err_msg: f"can't find collection collection not "
f"found[database=default]"}
error = {ct.err_code: 100, ct.err_msg: f"can't find collection[database=default][collection={collection_name}]"}
client_w.describe_collection(client, collection_name,
check_task=CheckTasks.err_res, check_items=error)

Expand Down Expand Up @@ -1048,7 +1046,7 @@ def test_milvus_client_rename_collection_duplicated_collection(self):
collection_name = cf.gen_unique_str(prefix)
# 1. create collection
client_w.create_collection(client, collection_name, default_dim)
error = {ct.err_code: 65535, ct.err_msg: f"duplicated new collection name default:{collection_name}"
error = {ct.err_code: 65535, ct.err_msg: f"duplicated new collection name default:{collection_name} "
f"with other collection name or alias"}
client_w.rename_collection(client, collection_name, collection_name,
check_task=CheckTasks.err_res, check_items=error)
Expand All @@ -1065,10 +1063,9 @@ def test_milvus_client_rename_deleted_collection(self):
# 1. create collection
client_w.create_collection(client, collection_name, default_dim)
client_w.drop_collection(client, collection_name)
error = {ct.err_code: 100, ct.err_msg: f"can't find collection collection not "
f"found[database=default]"}
error = {ct.err_code: 100, ct.err_msg: f"{collection_name}: collection not found[collection=default]"}
client_w.rename_collection(client, collection_name, "new_collection",
check_task=CheckTasks.err_res, check_items=error)
check_task=CheckTasks.err_res, check_items=error)


class TestMilvusClientRenameCollectionValid(TestcaseBase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ def test_milvus_client_collection_invalid_metric_type(self):
collection_name = cf.gen_unique_str(prefix)
# 1. create collection
error = {ct.err_code: 1100,
ct.err_msg: "metric type not found or not supported, supported: [L2 IP COSINE HAMMING JACCARD]"}
ct.err_msg: "float vector index does not support metric type: invalid: "
"invalid parameter[expected=valid index params][actual=invalid index params]"}
client_w.create_collection(client, collection_name, default_dim, metric_type="invalid",
check_task=CheckTasks.err_res, check_items=error)

Expand Down
4 changes: 2 additions & 2 deletions tests/python_client/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pytest-parallel
pytest-random-order

# pymilvus
pymilvus==2.5.0rc118
pymilvus[bulk_writer]==2.5.0rc118
pymilvus==2.5.0rc119
pymilvus[bulk_writer]==2.5.0rc119


# for customize config test
Expand Down
4 changes: 2 additions & 2 deletions tests/python_client/testcases/test_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,8 @@ def test_load_replica_change(self):
partition_w.load(replica_number=1)
collection_w.query(expr=f"{ct.default_int64_field_name} in [0]", check_task=CheckTasks.check_query_results,
check_items={'exp_res': [{'int64': 0}]})
error = {ct.err_code: 1100, ct.err_msg: "call query coordinator LoadCollection: can't change the replica number"
" for loaded collection: invalid parameter[expected=1][actual=2]"}
error = {ct.err_code: 1100, ct.err_msg: "=can't change the replica number for loaded partitions: "
"invalid parameter[expected=1][actual=2]"}
partition_w.load(replica_number=2, check_task=CheckTasks.err_res, check_items=error)

partition_w.release()
Expand Down

0 comments on commit 405c12f

Please sign in to comment.