Skip to content

Commit

Permalink
test: modify test cases (#28800)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
NicoYuan1986 authored Nov 29, 2023
1 parent 5bd73d5 commit 4d53980
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
4 changes: 1 addition & 3 deletions tests/python_client/testcases/test_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,6 @@ def test_partition_drop_default_partition(self):
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
Expand All @@ -721,8 +720,7 @@ def test_partition_drop_partition_twice(self):
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):
Expand Down
22 changes: 10 additions & 12 deletions tests/python_client/testcases/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,18 +570,18 @@ def test_search_with_expression_invalid_array_one(self):
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):
"""
Expand Down Expand Up @@ -6356,10 +6356,8 @@ def test_search_with_scalar_field(self, dim, _async, enable_dynamic_field):
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,
Expand Down

0 comments on commit 4d53980

Please sign in to comment.