From 9ef96db1234909756dece54e23053668b6538ce3 Mon Sep 17 00:00:00 2001 From: ThreadDao Date: Thu, 9 Mar 2023 19:11:57 +0800 Subject: [PATCH] Fix max collection name case (#22600) Signed-off-by: ThreadDao --- tests/python_client/base/collection_wrapper.py | 2 +- tests/python_client/common/common_type.py | 3 ++- tests/python_client/testcases/test_collection.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/python_client/base/collection_wrapper.py b/tests/python_client/base/collection_wrapper.py index 9f26dc39a7..cc16fad06f 100644 --- a/tests/python_client/base/collection_wrapper.py +++ b/tests/python_client/base/collection_wrapper.py @@ -124,7 +124,7 @@ class ApiCollectionWrapper: func_name = sys._getframe().f_code.co_name res, check = api_request([self.collection.insert, data, partition_name], **kwargs) check_result = ResponseChecker(res, func_name, check_task, check_items, check, - dat=data, partition_name=partition_name, + data=data, partition_name=partition_name, **kwargs).run() return res, check_result diff --git a/tests/python_client/common/common_type.py b/tests/python_client/common/common_type.py index 43e27e3972..a754707b94 100644 --- a/tests/python_client/common/common_type.py +++ b/tests/python_client/common/common_type.py @@ -60,6 +60,7 @@ compact_delta_ratio_reciprocal = 5 # compact_delta_binlog_ratio is 0.2 compact_retention_duration = 40 # compaction travel time retention range 20s max_compaction_interval = 60 # the max time interval (s) from the last compaction max_field_num = 64 # Maximum number of fields in a collection +max_name_length = 255 # Maximum length of name for a collection or alias default_replica_num = 1 IMAGE_REPOSITORY_MILVUS = "harbor.milvus.io/dockerhub/milvusdb/milvus" NAMESPACE_CHAOS_TESTING = "chaos-testing" @@ -92,7 +93,7 @@ get_invalid_strs = [ "(mn)", "中文", "%$#", - "a".join("a" for i in range(256))] + "".join("a" for i in range(max_name_length + 1))] get_not_string = [ [], diff --git a/tests/python_client/testcases/test_collection.py b/tests/python_client/testcases/test_collection.py index bc8142c91e..1bfe8047ba 100644 --- a/tests/python_client/testcases/test_collection.py +++ b/tests/python_client/testcases/test_collection.py @@ -131,7 +131,7 @@ class TestCollectionParams(TestcaseBase): check_items={exp_name: name, exp_schema: schema}) @pytest.mark.tags(CaseLabel.L2) - @pytest.mark.parametrize("name", ["12-s", "12 s", "(mn)", "中文", "%$#", "a".join("a" for i in range(256))]) + @pytest.mark.parametrize("name", ["12-s", "12 s", "(mn)", "中文", "%$#", "".join("a" for i in range(ct.max_name_length + 1))]) def test_collection_invalid_name(self, name): """ target: test collection with invalid name