From cbd3b3c8368122b4207ce6a8544dab04233523f8 Mon Sep 17 00:00:00 2001 From: nico <109071306+NicoYuan1986@users.noreply.github.com> Date: Mon, 4 Dec 2023 11:22:37 +0800 Subject: [PATCH] test: modify test cases for error msg update (#28846) #23075 Signed-off-by: nico --- .../python_client/testcases/test_collection.py | 17 +++++++---------- tests/python_client/testcases/test_partition.py | 8 ++++---- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/tests/python_client/testcases/test_collection.py b/tests/python_client/testcases/test_collection.py index bcc0c0cfd3..fe21b9525c 100644 --- a/tests/python_client/testcases/test_collection.py +++ b/tests/python_client/testcases/test_collection.py @@ -3301,11 +3301,10 @@ class TestLoadPartition(TestcaseBase): description=description, check_task=CheckTasks.check_partition_property, check_items={"name": partition_name, "description": description, - "is_empty": True, "num_entities": 0} - ) + "is_empty": True, "num_entities": 0}) collection_w.create_index(ct.default_float_vec_field_name, index_params=ct.default_flat_index) partition_w.drop() - error = {ct.err_code: 1, ct.err_msg: 'partitionID of partitionName:%s can not be find' % partition_name} + error = {ct.err_code: 200, ct.err_msg: 'partition not found[partition=%s]' % partition_name} partition_w.load(check_task=CheckTasks.err_res, check_items=error) @pytest.mark.tags(CaseLabel.L0) @@ -3323,8 +3322,7 @@ class TestLoadPartition(TestcaseBase): description=description, check_task=CheckTasks.check_partition_property, check_items={"name": partition_name, "description": description, - "is_empty": True, "num_entities": 0} - ) + "is_empty": True, "num_entities": 0}) partition_w.release() @pytest.mark.tags(CaseLabel.L2) @@ -3342,10 +3340,10 @@ class TestLoadPartition(TestcaseBase): description=description, check_task=CheckTasks.check_partition_property, check_items={"name": partition_name, "description": description, - "is_empty": True, "num_entities": 0} - ) + "is_empty": True, "num_entities": 0}) partition_w.drop() - error = {ct.err_code: 1, ct.err_msg: 'Partition %s not exist.' % partition_name} + collection_w.create_index(ct.default_float_vec_field_name) + error = {ct.err_code: 200, ct.err_msg: 'partition not found[partition=%s]' % partition_name} partition_w.load(check_task=CheckTasks.err_res, check_items=error) partition_w.release(check_task=CheckTasks.err_res, check_items=error) @@ -3385,8 +3383,7 @@ class TestLoadPartition(TestcaseBase): description=description, check_task=CheckTasks.check_partition_property, check_items={"name": partition_name, "description": description, - "is_empty": True, "num_entities": 0} - ) + "is_empty": True, "num_entities": 0}) collection_w.drop() error = {ct.err_code: 0, ct.err_msg: "collection not found"} partition_w.load(check_task=CheckTasks.err_res, check_items=error) diff --git a/tests/python_client/testcases/test_partition.py b/tests/python_client/testcases/test_partition.py index 71913d14a9..b00b47b7eb 100644 --- a/tests/python_client/testcases/test_partition.py +++ b/tests/python_client/testcases/test_partition.py @@ -833,7 +833,8 @@ class TestPartitionOperations(TestcaseBase): # release the dropped partition and check err response partition_w.release(check_task=CheckTasks.err_res, - check_items={ct.err_code: 1, ct.err_msg: PartitionErrorMessage.PartitionNotExist}) + check_items={ct.err_code: 200, ct.err_msg: "partition not found" + "[partition=%s]" % partition_w.name}) @pytest.mark.tags(CaseLabel.L2) def test_partition_release_dropped_collection(self): @@ -1345,9 +1346,8 @@ class TestDropBase(TestcaseBase): # check that the partition not exists assert not collection_w.has_partition(partition_name)[0] - - collection_w.drop_partition(partition_w.name, check_task=CheckTasks.err_res, - check_items={ct.err_code: 1, 'err_msg': "Partition not exist"}) + # now drop a non-existing partition will not raise error + collection_w.drop_partition(partition_name) @pytest.mark.tags(CaseLabel.L0) def test_drop_partition_create(self):