mirror of https://github.com/milvus-io/milvus.git
[test]Modify the search list testcase of diskann (#21183)
Signed-off-by: jingkl <jingjing.jia@zilliz.com> Signed-off-by: jingkl <jingjing.jia@zilliz.com>pull/21224/head
parent
437e44307a
commit
4592b969de
|
@ -4266,14 +4266,45 @@ class TestsearchDiskann(TestcaseBase):
|
||||||
)
|
)
|
||||||
|
|
||||||
@pytest.mark.tags(CaseLabel.L2)
|
@pytest.mark.tags(CaseLabel.L2)
|
||||||
@pytest.mark.parametrize("limit", [20])
|
@pytest.mark.parametrize("limit", [1])
|
||||||
@pytest.mark.parametrize("search_list", [10, 201])
|
@pytest.mark.parametrize("search_list", [-1, 0, 201])
|
||||||
def test_search_invalid_params_with_diskann_A(self, dim, auto_id, search_list, limit):
|
def test_search_invalid_params_with_diskann_A(self, dim, auto_id, search_list, limit):
|
||||||
"""
|
"""
|
||||||
target: test delete after creating index
|
target: test delete after creating index
|
||||||
method: 1.create collection , insert data, primary_field is int field
|
method: 1.create collection , insert data, primary_field is int field
|
||||||
2.create diskann index
|
2.create diskann index
|
||||||
3.search with invalid params, where topk <=20, search list (topk, 200]
|
3.search with invalid params, where topk <=20, search list [topk, 200]
|
||||||
|
expected: search report an error
|
||||||
|
"""
|
||||||
|
# 1. initialize with data
|
||||||
|
collection_w, _, _, insert_ids = \
|
||||||
|
self.init_collection_general(prefix, True, auto_id=auto_id, dim=dim, is_index=True)[0:4]
|
||||||
|
# 2. create index
|
||||||
|
default_index = {"index_type": "DISKANN", "metric_type":"L2", "params": {}}
|
||||||
|
collection_w.create_index(ct.default_float_vec_field_name, default_index)
|
||||||
|
collection_w.load()
|
||||||
|
default_search_params ={"metric_type": "L2", "params": {"search_list": search_list}}
|
||||||
|
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]
|
||||||
|
collection_w.search(vectors[:default_nq], default_search_field,
|
||||||
|
default_search_params, limit,
|
||||||
|
default_search_exp,
|
||||||
|
output_fields=output_fields,
|
||||||
|
travel_timestamp=0,
|
||||||
|
check_task=CheckTasks.err_res,
|
||||||
|
check_items={"err_code": 1,
|
||||||
|
"err_msg": "fail to search on all shard leaders"}
|
||||||
|
)
|
||||||
|
|
||||||
|
@pytest.mark.tags(CaseLabel.L2)
|
||||||
|
@pytest.mark.parametrize("limit", [20])
|
||||||
|
@pytest.mark.parametrize("search_list", [19, 201])
|
||||||
|
def test_search_invalid_params_with_diskann_B(self, dim, auto_id, search_list, limit):
|
||||||
|
"""
|
||||||
|
target: test delete after creating index
|
||||||
|
method: 1.create collection , insert data, primary_field is int field
|
||||||
|
2.create diskann index
|
||||||
|
3.search with invalid params, [k, 200] when k <= 20
|
||||||
expected: search report an error
|
expected: search report an error
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
|
@ -4298,44 +4329,13 @@ class TestsearchDiskann(TestcaseBase):
|
||||||
|
|
||||||
@pytest.mark.tags(CaseLabel.L2)
|
@pytest.mark.tags(CaseLabel.L2)
|
||||||
@pytest.mark.parametrize("limit", [6553])
|
@pytest.mark.parametrize("limit", [6553])
|
||||||
@pytest.mark.parametrize("search_list", [6553, 65531])
|
@pytest.mark.parametrize("search_list", [6550, 65536])
|
||||||
def test_search_invalid_params_with_diskann_B(self, dim, auto_id, search_list, limit):
|
|
||||||
"""
|
|
||||||
target: test delete after creating index
|
|
||||||
method: 1.create collection , insert data, primary_field is int field
|
|
||||||
2.create diskann index
|
|
||||||
3.search with invalid params, where 20< topk <= 6553, search list (topk, topk * 10]
|
|
||||||
expected: search report an error
|
|
||||||
"""
|
|
||||||
# 1. initialize with data
|
|
||||||
collection_w, _, _, insert_ids = \
|
|
||||||
self.init_collection_general(prefix, True, auto_id=auto_id, dim=dim, is_index=True)[0:4]
|
|
||||||
# 2. create index
|
|
||||||
default_index = {"index_type": "DISKANN", "metric_type":"L2", "params": {}}
|
|
||||||
collection_w.create_index(ct.default_float_vec_field_name, default_index)
|
|
||||||
collection_w.load()
|
|
||||||
default_search_params ={"metric_type": "L2", "params": {"search_list": search_list}}
|
|
||||||
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]
|
|
||||||
collection_w.search(vectors[:default_nq], default_search_field,
|
|
||||||
default_search_params, limit,
|
|
||||||
default_search_exp,
|
|
||||||
output_fields=output_fields,
|
|
||||||
travel_timestamp=0,
|
|
||||||
check_task=CheckTasks.err_res,
|
|
||||||
check_items={"err_code": 1,
|
|
||||||
"err_msg": "fail to search on all shard leaders"}
|
|
||||||
)
|
|
||||||
|
|
||||||
@pytest.mark.tags(CaseLabel.L2)
|
|
||||||
@pytest.mark.parametrize("limit", [6554])
|
|
||||||
@pytest.mark.parametrize("search_list", [6554, 65536])
|
|
||||||
def test_search_invalid_params_with_diskann_C(self, dim, auto_id, search_list, limit):
|
def test_search_invalid_params_with_diskann_C(self, dim, auto_id, search_list, limit):
|
||||||
"""
|
"""
|
||||||
target: test delete after creating index
|
target: test delete after creating index
|
||||||
method: 1.create collection , insert data, primary_field is int field
|
method: 1.create collection , insert data, primary_field is int field
|
||||||
2.create diskann index
|
2.create diskann index
|
||||||
3.search with invalid params, where topk > 6553, search list (topk, 65535]
|
3.search with invalid params , [k, min( 10 * topk, 65535)] when k > 20
|
||||||
expected: search report an error
|
expected: search report an error
|
||||||
"""
|
"""
|
||||||
# 1. initialize with data
|
# 1. initialize with data
|
||||||
|
|
Loading…
Reference in New Issue