From 121cf7fc7bcd13a28098effbc52a5b0da8c8ad03 Mon Sep 17 00:00:00 2001 From: NicoYuan1986 <109071306+NicoYuan1986@users.noreply.github.com> Date: Fri, 28 Oct 2022 10:17:32 +0800 Subject: [PATCH] Add pagination cases of query without limit (#20062) Signed-off-by: nico Signed-off-by: nico --- tests/python_client/testcases/test_index.py | 3 +-- tests/python_client/testcases/test_query.py | 22 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/tests/python_client/testcases/test_index.py b/tests/python_client/testcases/test_index.py index 6caf55f89d..9ec85a24c4 100644 --- a/tests/python_client/testcases/test_index.py +++ b/tests/python_client/testcases/test_index.py @@ -215,11 +215,10 @@ class TestIndexOperation(TestcaseBase): assert collection_w.indexes[0].params["index_type"] == default_index_params["index_type"] @pytest.mark.tags(CaseLabel.L1) - @pytest.mark.xfail(reason="issue 19972") def test_index_create_indexes_for_different_fields(self): """ target: Test create indexes for different fields - method: create two different indexes + method: create two different indexes with default index name expected: create successfully """ collection_w = self.init_collection_general(prefix, True, is_index=True)[0] diff --git a/tests/python_client/testcases/test_query.py b/tests/python_client/testcases/test_query.py index e19a63ecdb..327c881968 100644 --- a/tests/python_client/testcases/test_query.py +++ b/tests/python_client/testcases/test_query.py @@ -997,6 +997,28 @@ class TestQueryParams(TestcaseBase): collection_w.query(default_term_expr, params=query_params, check_task=CheckTasks.check_query_results, check_items={exp_res: res}) + @pytest.mark.tags(CaseLabel.L1) + def test_query_pagination_without_limit(self, offset): + """ + target: test query pagination without limit + method: create collection and query with pagination params(only offset), + compare the result with query without pagination params + expected: query successfully + """ + collection_w, vectors = self.init_collection_general(prefix, insert_data=True)[0:2] + int_values = vectors[0][ct.default_int64_field_name].values.tolist() + pos = 10 + term_expr = f'{ct.default_int64_field_name} in {int_values[offset: pos + offset]}' + res = vectors[0].iloc[offset:pos + offset, :1].to_dict('records') + query_params = {"offset": offset} + query_res = collection_w.query(term_expr, params=query_params, + check_task=CheckTasks.check_query_results, + check_items={exp_res: res})[0] + res = collection_w.query(term_expr, + check_task=CheckTasks.check_query_results, + check_items={exp_res: res})[0] + assert query_res == res + @pytest.mark.tags(CaseLabel.L2) @pytest.mark.xfail(reason="issue #19482") @pytest.mark.parametrize("limit", ["12 s", " ", [0, 1], {2}])