Skip to content

Commit

Permalink
test: add test cases for text match feature (#431)
Browse files Browse the repository at this point in the history
* test: add test cases for text match feature

Signed-off-by: zhuwenxing <[email protected]>

* test: fix

Signed-off-by: zhuwenxing <[email protected]>

* test: add text match test

Signed-off-by: zhuwenxing <[email protected]>

---------

Signed-off-by: zhuwenxing <[email protected]>
  • Loading branch information
zhuwenxing authored Sep 23, 2024
1 parent 2906920 commit 4d8d69c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 6 additions & 2 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
8 changes: 7 additions & 1 deletion tests/testcases/test_restore_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -652,13 +654,15 @@ 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):
def test_milvus_restore_back_with_sparse_vector_datatype(self, include_dynamic, include_partition_key, enable_text_match):
self._connect()
name_origin = cf.gen_unique_str(prefix)
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=enable_text_match),
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),
Expand All @@ -680,6 +684,7 @@ def test_milvus_restore_back_with_sparse_vector_datatype(self, include_dynamic,
data = [
[i for i in range(nb)],
[i % 3 for i in range(nb)],
[fake_en.text() for i in range(nb)],
[{f"key_{str(i)}": i} 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)],
Expand All @@ -694,6 +699,7 @@ def test_milvus_restore_back_with_sparse_vector_datatype(self, include_dynamic,
{
"int64": i,
"key": i % 3,
"text": fake_en.text(),
"json": {f"key_{str(i)}": i},
"var_array": [str(x) for x in range(10)],
"int_array": [int(x) for x in range(10)],
Expand Down

0 comments on commit 4d8d69c

Please sign in to comment.