mirror of https://github.com/milvus-io/milvus.git
Add test cases of ignore growing segment (#22865)
Signed-off-by: nico <cheng.yuan@zilliz.com>pull/22872/head
parent
5e74c60c52
commit
28f8dc89e5
|
@ -901,6 +901,28 @@ class TestQueryParams(TestcaseBase):
|
|||
collection_w.query(default_term_expr, partition_names=[partition_names],
|
||||
check_task=CheckTasks.err_res, check_items=error)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
def test_query_ignore_growing(self):
|
||||
"""
|
||||
target: test search ignoring growing segment
|
||||
method: 1. create a collection, insert data, create index and load
|
||||
2. insert data again
|
||||
3. query with param ignore_growing=True
|
||||
expected: query successfully
|
||||
"""
|
||||
# 1. create a collection
|
||||
collection_w = self.init_collection_general(prefix, True)[0]
|
||||
|
||||
# 2. insert data again
|
||||
data = cf.gen_default_dataframe_data(start=10000)
|
||||
collection_w.insert(data)
|
||||
|
||||
# 3. query with param ignore_growing=True
|
||||
res = collection_w.query('int64 >= 0', ignore_growing=True)[0]
|
||||
assert len(res) == ct.default_nb
|
||||
for ids in [res[i][default_int_field_name] for i in range(ct.default_nb)]:
|
||||
assert ids < 10000
|
||||
|
||||
@pytest.fixture(scope="function", params=[0, 10, 100])
|
||||
def offset(self, request):
|
||||
yield request.param
|
||||
|
|
|
@ -3178,6 +3178,37 @@ class TestCollectionSearch(TestcaseBase):
|
|||
"limit": nb_old + nb_new,
|
||||
"_async": _async})
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
def test_search_ignore_growing(self, nq, dim, _async):
|
||||
"""
|
||||
target: test search ignoring growing segment
|
||||
method: 1. create a collection, insert data, create index and load
|
||||
2. insert data again
|
||||
3. search with param ignore_growing=True
|
||||
expected: searched successfully
|
||||
"""
|
||||
# 1. create a collection
|
||||
collection_w = self.init_collection_general(prefix, True, dim=dim)[0]
|
||||
|
||||
# 2. insert data again
|
||||
data = cf.gen_default_dataframe_data(dim=dim, start=10000)
|
||||
collection_w.insert(data)
|
||||
|
||||
# 3. search with param ignore_growing=True
|
||||
search_params = {"metric_type": "L2", "params": {"nprobe": 10}, "ignore_growing": True}
|
||||
vector = [[random.random() for _ in range(dim)] for _ in range(nq)]
|
||||
res = collection_w.search(vector[:nq], default_search_field, search_params, default_limit,
|
||||
default_search_exp, _async=_async,
|
||||
check_task=CheckTasks.check_search_results,
|
||||
check_items={"nq": nq,
|
||||
"limit": default_limit,
|
||||
"_async": _async})[0]
|
||||
if _async:
|
||||
res.done()
|
||||
res = res.result()
|
||||
for ids in res[0].ids:
|
||||
assert ids < 10000
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
@pytest.mark.parametrize("name", ["_co11ection", "co11_ection"])
|
||||
@pytest.mark.parametrize("index_name", ["_1ndeX", "In_0"])
|
||||
|
|
Loading…
Reference in New Issue