From 1458df1475d8698daf2a81abbd406ed240677dd7 Mon Sep 17 00:00:00 2001 From: jingkl <34296482+jingkl@users.noreply.github.com> Date: Mon, 20 Dec 2021 19:57:08 +0800 Subject: [PATCH] Add testcase about load collection (#13665) Signed-off-by: jingkl --- .../testcases/test_collection.py | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/tests/python_client/testcases/test_collection.py b/tests/python_client/testcases/test_collection.py index 585807cb6f..d1d684564b 100644 --- a/tests/python_client/testcases/test_collection.py +++ b/tests/python_client/testcases/test_collection.py @@ -1073,6 +1073,54 @@ class TestCollectionOperation(TestcaseBase): c_name = cf.gen_unique_str(prefix) self.collection_wrap.init_collection(c_name, schema=schema, check_task=CheckTasks.check_collection_property, check_items={exp_name: c_name, exp_schema: schema}) + + @pytest.mark.tags(CaseLabel.L2) + def test_load_collection_after_load_partition(self): + """ + target: test release the partition after load collection + method: load collection and load the partition + expected: raise exception + """ + self._connect() + collection_w = self.init_collection_wrap() + partition_w1 = self.init_partition_wrap(collection_w) + partition_w1.insert(cf.gen_default_list_data()) + collection_w.load() + error = {ct.err_code: 1, ct.err_msg: f'load the partition after load collection is not supported'} + partition_w1.load(check_task=CheckTasks.err_res, + check_items=error) + + @pytest.mark.tags(CaseLabel.L2) + def test_load_collection_release_partition(self): + """ + target: test release the partition after load collection + method: load collection and release the partition + expected: raise exception + """ + self._connect() + collection_w = self.init_collection_wrap() + partition_w1 = self.init_partition_wrap(collection_w) + partition_w1.insert(cf.gen_default_list_data()) + collection_w.load() + error = {ct.err_code: 1, ct.err_msg: f'releasing the partition after load collection is not supported'} + partition_w1.release(check_task=CheckTasks.err_res, + check_items=error) + + @pytest.mark.tags(CaseLabel.L2) + def test_load_collection_after_release_collection(self): + """ + target: test release the collection after load collection + method: load collection and release the collection + expected: no exception + """ + self._connect() + c_name = cf.gen_unique_str(prefix) + collection_w = self.init_collection_wrap(name=c_name, check_task=CheckTasks.check_collection_property, + check_items={exp_name: c_name, exp_schema: default_schema}) + collection_w.insert(cf.gen_default_list_data()) + collection_w.load() + collection_w.release() + class TestCollectionDataframe(TestcaseBase):