From 51329c4c4be9d3f199f103e6e29f4622adc328bb Mon Sep 17 00:00:00 2001 From: zhuwenxing Date: Fri, 20 Sep 2024 18:27:08 +0800 Subject: [PATCH] test: add test cases for text match feature Signed-off-by: zhuwenxing --- tests/requirements.txt | 8 ++++++-- tests/testcases/test_restore_backup.py | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 92c9edb0..9845f900 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -21,12 +21,12 @@ pyopenssl pyasn1 pytest-html==3.1.1 delayed-assert==0.3.5 -kubernetes==17.17.0 +kubernetes==24.2.0 PyYAML==6.0 pytest-sugar==0.9.5 pytest-parallel pytest-random-order -numpy==1.25.0 +numpy==1.24.4 # for customize config test python-benedict==0.24.3 timeout-decorator==0.5.0 @@ -52,3 +52,7 @@ tenacity==8.1.0 # for bf16 datatype jax==0.4.13 jaxlib==0.4.13 + +# for text match +bm25s==0.2.0 +jieba==0.42.1 diff --git a/tests/testcases/test_restore_backup.py b/tests/testcases/test_restore_backup.py index 8ac15f31..fd728396 100644 --- a/tests/testcases/test_restore_backup.py +++ b/tests/testcases/test_restore_backup.py @@ -13,6 +13,8 @@ from common.common_type import CaseLabel from utils.util_log import test_log as log from api.milvus_backup import MilvusBackupClient +from faker import Faker +fake_en = Faker("en_US") prefix = "restore_backup" backup_prefix = "backup" suffix = "_bak" @@ -652,6 +654,7 @@ def test_milvus_restore_back_with_f16_bf16_datatype(self, include_dynamic, inclu @pytest.mark.parametrize("include_partition_key", [True]) @pytest.mark.parametrize("include_dynamic", [True]) + @pytest.mark.parametrize("enable_text_match", [True]) @pytest.mark.tags(CaseLabel.MASTER) def test_milvus_restore_back_with_sparse_vector_datatype(self, include_dynamic, include_partition_key): self._connect() @@ -659,6 +662,7 @@ def test_milvus_restore_back_with_sparse_vector_datatype(self, include_dynamic, back_up_name = cf.gen_unique_str(backup_prefix) fields = [cf.gen_int64_field(name="int64", is_primary=True), cf.gen_int64_field(name="key"), + cf.gen_string_field(name="text", enable_match=True), cf.gen_json_field(name="json"), cf.gen_array_field(name="var_array", element_type=DataType.VARCHAR), cf.gen_array_field(name="int_array", element_type=DataType.INT64), @@ -681,6 +685,7 @@ def test_milvus_restore_back_with_sparse_vector_datatype(self, include_dynamic, [i for i in range(nb)], [i % 3 for i in range(nb)], [{f"key_{str(i)}": i} for i in range(nb)], + [fake_en.text() for i in range(nb)], [[str(x) for x in range(10)] for i in range(nb)], [[int(x) for x in range(10)] for i in range(nb)], [[np.float32(i) for i in range(128)] for _ in range(nb)],