Add more cases to test shard_num valid range (#18965)

Signed-off-by: “nico” <cheng.yuan@zilliz.com>

Signed-off-by: “nico” <cheng.yuan@zilliz.com>
pull/18975/head
NicoYuan1986 2022-09-01 17:08:58 +08:00 committed by GitHub
parent 05c724ad6d
commit 3cf6cf3802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 2 deletions

View File

@ -902,8 +902,8 @@ class TestCollectionParams(TestcaseBase):
check_items={exp_name: c_name, exp_shards_num: default_shards_num})
assert c_name in self.utility_wrap.list_collections()[0]
@pytest.mark.tags(CaseLabel.L0)
@pytest.mark.parametrize("shards_num", [-256, 0, 10, 256])
@pytest.mark.tags(CaseLabel.L2)
@pytest.mark.parametrize("shards_num", [-256, 0, 1, 10, 214, 256])
def test_collection_shards_num_with_not_default_value(self, shards_num):
"""
target:test collection with shards_num
@ -917,6 +917,20 @@ class TestCollectionParams(TestcaseBase):
check_items={exp_name: c_name, exp_shards_num: shards_num})
assert c_name in self.utility_wrap.list_collections()[0]
@pytest.mark.tags(CaseLabel.L2)
@pytest.mark.parametrize("shards_num", [257])
def test_collection_shards_num_invalid(self, shards_num):
"""
target:test collection with invalid shards_num
method:create collection with shards_num out of [1,256]
expected: raise exception
"""
self._connect()
c_name = cf.gen_unique_str(prefix)
error = {ct.err_code: 1, ct.err_msg: "maximum shards's number should be limited to 256"}
self.collection_wrap.init_collection(c_name, schema=default_schema, shards_num=shards_num,
check_task=CheckTasks.err_res, check_items=error)
@pytest.mark.tags(CaseLabel.L2)
def test_collection_shards_num_with_error_type(self):
"""