diff --git a/tests/python_client/base/collection_wrapper.py b/tests/python_client/base/collection_wrapper.py index e577db6d0ea50e550fdf9d1c5f281e6734dfc0f2..49730047955f5c62342ea374fe49d8a6201fc782 100644 --- a/tests/python_client/base/collection_wrapper.py +++ b/tests/python_client/base/collection_wrapper.py @@ -175,7 +175,7 @@ class ApiCollectionWrapper: timeout = TIMEOUT if timeout is None else timeout func_name = sys._getframe().f_code.co_name - res, check = api_request([self.collection.query, expr, output_fields, partition_names, timeout]) + res, check = api_request([self.collection.query, expr, output_fields, partition_names, timeout], **kwargs) check_result = ResponseChecker(res, func_name, check_task, check_items, check, expression=expr, partition_names=partition_names, output_fields=output_fields, diff --git a/tests/python_client/testcases/test_query.py b/tests/python_client/testcases/test_query.py index 502044703fa46d64e4588d2dc8c7cdfa2bc9ad8c..547b2f3678bd021c97faf8de2e87b9be04d7c98d 100644 --- a/tests/python_client/testcases/test_query.py +++ b/tests/python_client/testcases/test_query.py @@ -1019,7 +1019,6 @@ class TestQueryParams(TestcaseBase): assert query_res == res @pytest.mark.tags(CaseLabel.L2) - @pytest.mark.xfail(reason="issue #19482") @pytest.mark.parametrize("limit", ["12 s", " ", [0, 1], {2}]) def test_query_pagination_with_invalid_limit_type(self, limit): """ @@ -1032,14 +1031,12 @@ class TestQueryParams(TestcaseBase): int_values = vectors[0][ct.default_int64_field_name].values.tolist() pos = 10 term_expr = f'{ct.default_int64_field_name} in {int_values[10: pos+10]}' - res = vectors[0].iloc[10: pos+10, :1].to_dict('records') - query_params = {"offset": 10, "limit": limit} - collection_w.query(term_expr, params=query_params, - check_task=CheckTasks.check_query_results, - check_items={exp_res: res}) + collection_w.query(term_expr, offset=10, limit=limit, + check_task=CheckTasks.err_res, + check_items={ct.err_code: 1, + ct.err_msg: "limit [%s] is invalid" % limit}) @pytest.mark.tags(CaseLabel.L2) - @pytest.mark.xfail(reason="issue #19482") @pytest.mark.parametrize("limit", [-1, 67890]) def test_query_pagination_with_invalid_limit_value(self, limit): """ @@ -1052,14 +1049,13 @@ class TestQueryParams(TestcaseBase): int_values = vectors[0][ct.default_int64_field_name].values.tolist() pos = 10 term_expr = f'{ct.default_int64_field_name} in {int_values[10: pos + 10]}' - res = vectors[0].iloc[10: pos + 10, :1].to_dict('records') - query_params = {"offset": 10, "limit": limit} - collection_w.query(term_expr, params=query_params, - check_task=CheckTasks.check_query_results, - check_items={exp_res: res}) + collection_w.query(term_expr, offset=10, limit=limit, + check_task=CheckTasks.err_res, + check_items={ct.err_code: 1, + ct.err_msg: "limit [%s] is invalid, should be in range " + "[1, 16384], but got %s" % (limit, limit)}) @pytest.mark.tags(CaseLabel.L2) - @pytest.mark.xfail(reason="issue #19482") @pytest.mark.parametrize("offset", ["12 s", " ", [0, 1], {2}]) def test_query_pagination_with_invalid_offset_type(self, offset): """ @@ -1072,14 +1068,12 @@ class TestQueryParams(TestcaseBase): int_values = vectors[0][ct.default_int64_field_name].values.tolist() pos = 10 term_expr = f'{ct.default_int64_field_name} in {int_values[10: pos + 10]}' - res = vectors[0].iloc[10: pos + 10, :1].to_dict('records') - query_params = {"offset": offset, "limit": 10} - collection_w.query(term_expr, params=query_params, - check_task=CheckTasks.check_query_results, - check_items={exp_res: res}) + collection_w.query(term_expr, offset=offset, limit=10, + check_task=CheckTasks.err_res, + check_items={ct.err_code: 1, + ct.err_msg: "offset [%s] is invalid" % offset}) @pytest.mark.tags(CaseLabel.L2) - @pytest.mark.xfail(reason="issue #19482") @pytest.mark.parametrize("offset", [-1, 67890]) def test_query_pagination_with_invalid_offset_value(self, offset): """ @@ -1092,11 +1086,11 @@ class TestQueryParams(TestcaseBase): int_values = vectors[0][ct.default_int64_field_name].values.tolist() pos = 10 term_expr = f'{ct.default_int64_field_name} in {int_values[10: pos + 10]}' - res = vectors[0].iloc[10: pos + 10, :1].to_dict('records') - query_params = {"offset": offset, "limit": 10} - collection_w.query(term_expr, params=query_params, - check_task=CheckTasks.check_query_results, - check_items={exp_res: res}) + collection_w.query(term_expr, offset=offset, limit=10, + check_task=CheckTasks.err_res, + check_items={ct.err_code: 1, + ct.err_msg: "offset [%s] is invalid, should be in range " + "[1, 16384], but got %s" % (offset, offset)}) class TestQueryOperation(TestcaseBase): diff --git a/tests/python_client/testcases/test_search.py b/tests/python_client/testcases/test_search.py index 2da9f8aecb5a50debe671c77e94443e94c16c6aa..10917df83ca57b73d58d0d9c39f84e470679a8af 100644 --- a/tests/python_client/testcases/test_search.py +++ b/tests/python_client/testcases/test_search.py @@ -3879,8 +3879,7 @@ class TestsearchPagination(TestcaseBase): assert search_res[0].ids == res[0].ids[offset:] @pytest.mark.tags(CaseLabel.L2) - @pytest.mark.skip(reason="wait to test") - @pytest.mark.parametrize("limit", [1, 10, 100, 3000]) + @pytest.mark.parametrize("limit", [100, 3000, 10000]) def test_search_with_pagination_topK(self, auto_id, dim, limit, _async): """ target: test search with pagination limit + offset = topK @@ -3893,7 +3892,7 @@ class TestsearchPagination(TestcaseBase): # 1. create a collection topK = 16384 offset = topK - limit - collection_w = self.init_collection_general(prefix, True, auto_id=auto_id, dim=dim)[0] + collection_w = self.init_collection_general(prefix, True, nb=20000, auto_id=auto_id, dim=dim)[0] # 2. search search_param = {"metric_type": "L2", "params": {"nprobe": 10}, "offset": offset} vectors = [[random.random() for _ in range(dim)] for _ in range(default_nq)]