From 25c71c70d55feddb2e7219b8997b65a70d766e6e Mon Sep 17 00:00:00 2001 From: zhuwenxing Date: Mon, 27 Mar 2023 13:27:40 +0800 Subject: [PATCH] test: add test case for auto id (#114) Signed-off-by: zhuwenxing --- tests/base/client_base.py | 2 +- tests/testcases/test_restore_backup.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/base/client_base.py b/tests/base/client_base.py index ced70b2..99d93f4 100644 --- a/tests/base/client_base.py +++ b/tests/base/client_base.py @@ -262,7 +262,7 @@ def prepare_data(self, name=None, nb=ct.default_nb, dim=ct.default_dim, is_binar collection_w = self.init_collection_wrap(name=name, schema=default_schema, active_trace=True) assert collection_w.name == name if nb > 0: - cf.insert_data(collection_w, nb=nb, is_binary=is_binary, dim=dim) + cf.insert_data(collection_w, nb=nb, is_binary=is_binary, auto_id=auto_id, dim=dim) if is_flushed: collection_w.flush(timeout=180) if check_function: diff --git a/tests/testcases/test_restore_backup.py b/tests/testcases/test_restore_backup.py index 9475f7b..c556fe5 100644 --- a/tests/testcases/test_restore_backup.py +++ b/tests/testcases/test_restore_backup.py @@ -19,25 +19,26 @@ class TestRestoreBackup(TestcaseBase): @pytest.mark.tags(CaseLabel.L1) @pytest.mark.parametrize("nb", [0, 3000]) + @pytest.mark.parametrize("is_auto_id", [True, False]) @pytest.mark.parametrize("is_async", [True, False]) @pytest.mark.parametrize("collection_need_to_restore", [1, 2, 3]) @pytest.mark.parametrize("collection_type", ["binary", "float", "all"]) - def test_milvus_restore_back(self, collection_type, collection_need_to_restore, is_async, nb): + def test_milvus_restore_back(self, collection_type, collection_need_to_restore, is_async, is_auto_id, nb): # prepare data names_origin = [] back_up_name = cf.gen_unique_str(backup_prefix) if collection_type == "all": for is_binary in [True, False, False]: names_origin.append(cf.gen_unique_str(prefix)) - self.prepare_data(names_origin[-1], nb=nb, is_binary=is_binary, check_function=False) + self.prepare_data(names_origin[-1], nb=nb, is_binary=is_binary, auto_id=is_auto_id, check_function=False) if collection_type == "float": for is_binary in [False, False, False]: names_origin.append(cf.gen_unique_str(prefix)) - self.prepare_data(names_origin[-1], nb=nb, is_binary=is_binary, check_function=False) + self.prepare_data(names_origin[-1], nb=nb, is_binary=is_binary, auto_id=is_auto_id, check_function=False) if collection_type == "binary": for is_binary in [True, True, True]: names_origin.append(cf.gen_unique_str(prefix)) - self.prepare_data(names_origin[-1], nb=nb, is_binary=is_binary, check_function=False) + self.prepare_data(names_origin[-1], nb=nb, is_binary=is_binary, auto_id=is_auto_id, check_function=False) log.info(f"name_origin:{names_origin}, back_up_name: {back_up_name}") for name in names_origin: res, _ = self.utility_wrap.has_collection(name)