From ac3dcb6571bb23b12f27e0d82e64515e1c9f2b0e Mon Sep 17 00:00:00 2001 From: Bingyi Sun Date: Mon, 16 Dec 2024 12:09:42 +0800 Subject: [PATCH] enhance: allow hyphen in partition name (#38461) Signed-off-by: sunby --- internal/proxy/util.go | 2 +- .../milvus_client/test_milvus_client_insert.py | 4 ++-- .../milvus_client/test_milvus_client_partition.py | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/proxy/util.go b/internal/proxy/util.go index dae3c88c56fe4..0fea818e98126 100644 --- a/internal/proxy/util.go +++ b/internal/proxy/util.go @@ -238,7 +238,7 @@ func validatePartitionTag(partitionTag string, strictCheck bool) error { tagSize := len(partitionTag) for i := 1; i < tagSize; i++ { c := partitionTag[i] - if c != '_' && !isAlpha(c) && !isNumber(c) { + if c != '_' && !isAlpha(c) && !isNumber(c) && c != '-' { msg := invalidMsg + "Partition name can only contain numbers, letters and underscores." return errors.New(msg) } diff --git a/tests/python_client/milvus_client/test_milvus_client_insert.py b/tests/python_client/milvus_client/test_milvus_client_insert.py index d1aba2cb2f874..1519c62aca1da 100644 --- a/tests/python_client/milvus_client/test_milvus_client_insert.py +++ b/tests/python_client/milvus_client/test_milvus_client_insert.py @@ -281,7 +281,7 @@ def test_milvus_client_insert_not_matched_data(self): check_task=CheckTasks.err_res, check_items=error) @pytest.mark.tags(CaseLabel.L1) - @pytest.mark.parametrize("partition_name", ["12-s", "12 s", "(mn)", "中文", "%$#", " "]) + @pytest.mark.parametrize("partition_name", ["12 s", "(mn)", "中文", "%$#", " "]) def test_milvus_client_insert_invalid_partition_name(self, partition_name): """ target: test milvus client: insert extra field than schema @@ -749,7 +749,7 @@ def test_milvus_client_upsert_not_matched_data(self): check_task=CheckTasks.err_res, check_items=error) @pytest.mark.tags(CaseLabel.L1) - @pytest.mark.parametrize("partition_name", ["12-s", "12 s", "(mn)", "中文", "%$#", " "]) + @pytest.mark.parametrize("partition_name", ["12 s", "(mn)", "中文", "%$#", " "]) def test_milvus_client_upsert_invalid_partition_name(self, partition_name): """ target: test milvus client: insert extra field than schema diff --git a/tests/python_client/milvus_client/test_milvus_client_partition.py b/tests/python_client/milvus_client/test_milvus_client_partition.py index 152d5aa0377eb..5296f8ec2f6c7 100644 --- a/tests/python_client/milvus_client/test_milvus_client_partition.py +++ b/tests/python_client/milvus_client/test_milvus_client_partition.py @@ -114,7 +114,7 @@ def test_milvus_client_partition_not_exist_collection_name(self): check_task=CheckTasks.err_res, check_items=error) @pytest.mark.tags(CaseLabel.L1) - @pytest.mark.parametrize("partition_name", ["12-s", "12 s", "(mn)", "中文", "%$#"]) + @pytest.mark.parametrize("partition_name", ["12 s", "(mn)", "中文", "%$#"]) def test_milvus_client_partition_invalid_partition_name(self, partition_name): """ target: test fast create collection normal case @@ -385,7 +385,7 @@ def test_milvus_client_drop_partition_not_exist_collection_name(self): check_task=CheckTasks.err_res, check_items=error) @pytest.mark.tags(CaseLabel.L1) - @pytest.mark.parametrize("partition_name", ["12-s", "12 s", "(mn)", "中文", "%$#"]) + @pytest.mark.parametrize("partition_name", ["12 s", "(mn)", "中文", "%$#"]) def test_milvus_client_drop_partition_invalid_partition_name(self, partition_name): """ target: test fast create collection normal case @@ -485,7 +485,7 @@ def test_milvus_client_release_partition_not_exist_collection_name(self): @pytest.mark.tags(CaseLabel.L1) @pytest.mark.xfail(reason="pymilvus issue 1896") - @pytest.mark.parametrize("partition_name", ["12-s", "12 s", "(mn)", "中文", "%$#"]) + @pytest.mark.parametrize("partition_name", ["12 s", "(mn)", "中文", "%$#"]) def test_milvus_client_release_partition_invalid_partition_name(self, partition_name): """ target: test release partition -- invalid partition name value @@ -813,7 +813,7 @@ def test_milvus_client_has_partition_not_exist_collection_name(self): check_task=CheckTasks.err_res, check_items=error) @pytest.mark.tags(CaseLabel.L1) - @pytest.mark.parametrize("partition_name", ["12-s", "12 s", "(mn)", "中文", "%$#"]) + @pytest.mark.parametrize("partition_name", ["12 s", "(mn)", "中文", "%$#"]) def test_milvus_client_has_partition_invalid_partition_name(self, partition_name): """ target: test fast create collection normal case @@ -935,7 +935,7 @@ def test_milvus_client_load_partitions_collection_name_over_max_length(self): check_task=CheckTasks.err_res, check_items=error) @pytest.mark.tags(CaseLabel.L1) - @pytest.mark.parametrize("name", ["12-s", "12 s", "(mn)", "中文", "%$#"]) + @pytest.mark.parametrize("name", ["12 s", "(mn)", "中文", "%$#"]) def test_milvus_client_load_partitions_invalid_partition_name(self, name): """ target: test fast create collection normal case