未验证 提交 bcd316a4 编写于 作者: N NicoYuan1986 提交者: GitHub

Add test case of Varchar limits (#22652)

Signed-off-by: Nnico <cheng.yuan@zilliz.com>
上级 9ef96db1
......@@ -496,6 +496,27 @@ class TestInsertOperation(TestcaseBase):
error = {ct.err_code: 1, ct.err_msg: "The type of data should be list or pandas.DataFrame"}
collection_w.insert(data=df, check_task=CheckTasks.err_res, check_items=error)
@pytest.mark.tags(CaseLabel.L1)
def test_insert_exceed_varchar_limit(self):
"""
target: test insert exceed varchar limit
method: create a collection with varchar limit=2 and insert invalid data
expected: error raised
"""
fields = [
cf.gen_int64_field(is_primary=True),
cf.gen_float_vec_field(),
cf.gen_string_field(name='small_limit', max_length=2),
cf.gen_string_field(name='big_limit', max_length=65530)
]
schema = cf.gen_collection_schema(fields, auto_id=True)
name = cf.gen_unique_str(prefix)
collection_w = self.init_collection_wrap(name, schema)
vectors = cf.gen_vectors(2, ct.default_dim)
data = [vectors, ["limit_1___________", "limit_2___________"], ['1', '2']]
error = {ct.err_code: 1, ct.err_msg: "invalid input, length of string exceeds max length"}
collection_w.insert(data, check_task=CheckTasks.err_res, check_items=error)
@pytest.mark.tags(CaseLabel.L2)
def test_insert_with_lack_vector_field(self):
"""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册