From 4d5398045679b3b0efb20d35bfa854aa0f4d5c2d Mon Sep 17 00:00:00 2001 From: nico <109071306+NicoYuan1986@users.noreply.github.com> Date: Wed, 29 Nov 2023 10:26:26 +0800 Subject: [PATCH] test: modify test cases (#28800) 1. Drop a non-existing partition will not raise error now. #28722 2. Search will not raise error now when some row has less elements than expression index. #28293 Signed-off-by: nico --- .../python_client/testcases/test_partition.py | 4 +--- tests/python_client/testcases/test_search.py | 22 +++++++++---------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/tests/python_client/testcases/test_partition.py b/tests/python_client/testcases/test_partition.py index 1e29f9480a..71913d14a9 100644 --- a/tests/python_client/testcases/test_partition.py +++ b/tests/python_client/testcases/test_partition.py @@ -699,7 +699,6 @@ class TestPartitionOperations(TestcaseBase): check_items={ct.err_code: 1, ct.err_msg: "default partition cannot be deleted"}) @pytest.mark.tags(CaseLabel.L1) - @pytest.mark.skip("issue #28722") def test_partition_drop_partition_twice(self): """ target: verify drop the same partition twice @@ -721,8 +720,7 @@ class TestPartitionOperations(TestcaseBase): assert not collection_w.has_partition(partition_name)[0] # verify that drop the partition again with exception - partition_w.drop(check_task=CheckTasks.err_res, - check_items={ct.err_code: 1, ct.err_msg: PartitionErrorMessage.PartitionNotExist}) + partition_w.drop() @pytest.mark.tags(CaseLabel.L2) def test_partition_create_and_drop_multi_times(self): diff --git a/tests/python_client/testcases/test_search.py b/tests/python_client/testcases/test_search.py index 269b763791..28fcda65cd 100644 --- a/tests/python_client/testcases/test_search.py +++ b/tests/python_client/testcases/test_search.py @@ -570,18 +570,18 @@ class TestCollectionSearchInvalid(TestcaseBase): collection_w.create_index("float_vector", ct.default_index) collection_w.load() - # 2. search + # 2. search (subscript > max_capacity) expression = "int32_array[101] > 0" - # msg = ("failed to search: attempt #0: failed to search/query delegator 1 for channel " - # "by-dev-rootcoord-dml_: fail to Search, QueryNode ID=1, reason=worker(1) query" - # " failed: UnknownError: Assert \")index >= 0 && index < length_\" at /go/src/" - # "github.com/milvus-io/milvus/internal/core/src/common/Array.h:454 => index out" - # " of range, index=101, length=100: attempt #1: no available shard delegator " - # "found: service unavailable") res, _ = collection_w.search(vectors[:default_nq], default_search_field, - default_search_params, nb, expression) + default_search_params, nb, expression) assert len(res[0]) == 0 + # 3. search (max_capacity > subscript > actual length of array) + expression = "int32_array[51] > 0" + res, _ = collection_w.search(vectors[:default_nq], default_search_field, + default_search_params, default_limit, expression) + assert len(res[0]) == default_limit + @pytest.mark.tags(CaseLabel.L1) def test_search_with_expression_invalid_array_two(self): """ @@ -6356,10 +6356,8 @@ class TestSearchDiskann(TestcaseBase): collection_w.load() default_expr = "int64 in [1, 2, 3, 4]" limit = 4 - default_search_params = { - "metric_type": "COSINE", "params": {"nprobe": 64}} - vectors = [[random.random() for _ in range(dim)] - for _ in range(default_nq)] + default_search_params = {"metric_type": "COSINE", "params": {"nprobe": 64}} + vectors = [[random.random() for _ in range(dim)]for _ in range(default_nq)] output_fields = [default_int64_field_name, default_float_field_name, default_string_field_name] search_res = collection_w.search(vectors[:default_nq], default_search_field,