From 1ca71a2a659244cd2ac1c5af81120cb6403be8c6 Mon Sep 17 00:00:00 2001 From: binbin <83755740+binbinlv@users.noreply.github.com> Date: Tue, 15 Mar 2022 14:37:21 +0800 Subject: [PATCH] [skip e2e] Add search test case (#16044) Signed-off-by: Binbin Lv --- .../python_client/testcases/test_search_20.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/python_client/testcases/test_search_20.py b/tests/python_client/testcases/test_search_20.py index 657e63961b..e1aa0d42ad 100644 --- a/tests/python_client/testcases/test_search_20.py +++ b/tests/python_client/testcases/test_search_20.py @@ -549,6 +549,35 @@ class TestCollectionSearchInvalid(TestcaseBase): "ids": insert_res.primary_keys, "limit": default_limit}) + @pytest.mark.tags(CaseLabel.L2) + def test_search_with_empty_collection_with_partition(self): + """ + target: test search with empty collection + method: 1. collection an empty collection with partitions + 2. load + 3. search + expected: return 0 result + """ + # 1. initialize without data + collection_w = self.init_collection_general(prefix, partition_num=1)[0] + par = collection_w.partitions + # 2. search collection without data after load + collection_w.load() + collection_w.search(vectors[:default_nq], default_search_field, default_search_params, + default_limit, default_search_exp, + check_task=CheckTasks.check_search_results, + check_items={"nq": default_nq, + "ids": [], + "limit": 0}) + # 2. search a partition without data after load + collection_w.search(vectors[:default_nq], default_search_field, default_search_params, + default_limit, default_search_exp, + [par[1].name], + check_task=CheckTasks.check_search_results, + check_items={"nq": default_nq, + "ids": [], + "limit": 0}) + @pytest.mark.tags(CaseLabel.L1) def test_search_partition_deleted(self): """