Add testcase with max field num (#13050)

* Add testcase with max field num

Signed-off-by: jingkl <jingjing.jia@zilliz.com>

* Add testcase with max field num

Signed-off-by: jingkl <jingjing.jia@zilliz.com>
This commit is contained in:
jingkl 2021-12-09 16:55:28 +08:00 committed by GitHub
parent 23e3a88a41
commit 0ac30342f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -929,7 +929,49 @@ class TestCollectionParams(TestcaseBase):
error = {ct.err_code: -1, ct.err_msg: f"expected one of: int, long"}
self.collection_wrap.init_collection(c_name, schema=default_schema, shards_num=error_type_shards_num,
check_task=CheckTasks.err_res,
check_items=error)
check_items=error)
@pytest.mark.tags(CaseLabel.L2)
def test_create_collection_maximum_fields(self):
"""
target: test create collection with maximum fields
method: create collection with maximum field number
expected: no exception
"""
self._connect()
c_name = cf.gen_unique_str(prefix)
int_fields=[]
limit_num=254
for i in range(limit_num):
field_name =cf.gen_unique_str("field_name")
field=cf.gen_int64_field(name=field_name)
int_fields.append(field)
int_fields.append(cf.gen_float_vec_field())
int_fields.append(cf.gen_int64_field(is_primary=True))
schema = cf.gen_collection_schema(fields=int_fields)
self.collection_wrap.init_collection(c_name, schema=schema, check_task=CheckTasks.check_collection_property,
check_items={exp_name: c_name, exp_schema: schema})
@pytest.mark.tags(CaseLabel.L2)
def test_create_collection_over_maximum_fields(self):
"""
target: Test create collection with more than the maximum fields
method: create collection with more than the maximum field number
expected: raise exception
"""
self._connect()
c_name = cf.gen_unique_str(prefix)
int_fields=[]
limit_num=256
for i in range(limit_num):
field_name =cf.gen_unique_str("field_name")
field=cf.gen_int64_field(name=field_name)
int_fields.append(field)
int_fields.append(cf.gen_float_vec_field())
int_fields.append(cf.gen_int64_field(is_primary=True))
schema = cf.gen_collection_schema(fields=int_fields)
error = {ct.err_code: 1, ct.err_msg: "maximum field's number should be limited to 256"}
self.collection_wrap.init_collection(c_name, schema=schema, check_task=CheckTasks.err_res, check_items=error)
class TestCollectionOperation(TestcaseBase):