Skip to content

Commit

Permalink
enhance: allow hyphen in partition name (#38494)
Browse files Browse the repository at this point in the history
Signed-off-by: sunby <[email protected]>
  • Loading branch information
sunby authored Dec 18, 2024
1 parent 5394f47 commit 894c203
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion internal/proxy/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,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)
}
Expand Down
1 change: 0 additions & 1 deletion tests/go_client/common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func GenInvalidNames() []string {
invalidNames := []string{
"",
" ",
"12-s",
"(mn)",
"中文",
"%$#",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,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
Expand Down Expand Up @@ -739,7 +739,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -384,7 +384,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
Expand Down Expand Up @@ -483,7 +483,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
Expand Down Expand Up @@ -809,7 +809,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
Expand Down Expand Up @@ -930,7 +930,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
Expand Down

0 comments on commit 894c203

Please sign in to comment.