Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
885d57c4
M
milvus
项目概览
milvus
/
milvus
大约 1 年 前同步成功
通知
261
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
885d57c4
编写于
5月 07, 2022
作者:
J
jingkl
提交者:
GitHub
5月 07, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[test] Add string testcase to collection (#16834)
Signed-off-by:
N
jingkl
<
jingjing.jia@zilliz.com
>
上级
c7935d1a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
118 addition
and
22 deletion
+118
-22
tests/python_client/testcases/test_collection.py
tests/python_client/testcases/test_collection.py
+118
-22
未找到文件。
tests/python_client/testcases/test_collection.py
浏览文件 @
885d57c4
...
...
@@ -1074,22 +1074,7 @@ class TestCollectionOperation(TestcaseBase):
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
.
L1
)
def
test_collection_string_field
(
self
):
"""
target: test create with string field
method: create collection with string field
expected: Raise exception
"""
self
.
_connect
()
string_field
=
self
.
field_schema_wrap
.
init_field_schema
(
name
=
"string"
,
dtype
=
DataType
.
STRING
)[
0
]
int_field
=
cf
.
gen_int64_field
(
is_primary
=
True
)
vec_field
=
cf
.
gen_float_vec_field
()
schema
=
cf
.
gen_collection_schema
(
fields
=
[
int_field
,
string_field
,
vec_field
])
error
=
{
ct
.
err_code
:
0
,
ct
.
err_msg
:
"string data type not supported yet"
}
self
.
collection_wrap
.
init_collection
(
name
=
cf
.
gen_unique_str
(
prefix
),
schema
=
schema
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_load_collection_after_load_partition
(
self
):
"""
...
...
@@ -1442,7 +1427,7 @@ class TestCollectionDataframe(TestcaseBase):
class
TestCollectionCount
(
TestcaseBase
):
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_collection_count_no_vectors
(
self
,
connect
,
collection
):
def
test_collection_count_no_vectors
(
self
):
"""
target: test collection rows_count is correct or not, if collection is empty
method: create collection and no vectors in it,
...
...
@@ -2597,7 +2582,7 @@ class TestLoadPartition(TestcaseBase):
partition_w
.
load
(
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_release_partition_dis_connect
(
self
,
connect
,
dis_connect
,
collection
):
def
test_release_partition_dis_connect
(
self
):
"""
target: test release collection, without connection
method: release collection with correct params, with a disconnected instance
...
...
@@ -2621,7 +2606,7 @@ class TestLoadPartition(TestcaseBase):
partition_w
.
release
(
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_load_partition_not_existed
(
self
,
connect
,
collection
):
def
test_load_partition_not_existed
(
self
):
"""
target: test load partition for invalid scenario
method: load not existed partition
...
...
@@ -2661,7 +2646,7 @@ class TestLoadPartition(TestcaseBase):
partition_w
.
release
()
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_load_release_after_drop
(
self
,
connect
,
collection
):
def
test_load_release_after_drop
(
self
):
"""
target: test load and release partition after drop
method: drop partition and then load and release it
...
...
@@ -2683,7 +2668,7 @@ class TestLoadPartition(TestcaseBase):
partition_w
.
release
(
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L0
)
def
test_release_partition_after_drop
(
self
,
connect
,
collection
):
def
test_release_partition_after_drop
(
self
):
"""
target: test release collection after drop
method: insert and flush, then release collection after load and drop
...
...
@@ -2704,7 +2689,7 @@ class TestLoadPartition(TestcaseBase):
partition_w
.
release
(
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L0
)
def
test_load_release_after_collection_drop
(
self
,
connect
,
collection
):
def
test_load_release_after_collection_drop
(
self
):
"""
target: test release collection after drop
method: insert and flush, then release collection after load and drop
...
...
@@ -2725,3 +2710,114 @@ class TestLoadPartition(TestcaseBase):
error
=
{
ct
.
err_code
:
0
,
ct
.
err_msg
:
"HasPartition failed: can
\'
t find collection: %s"
%
name
}
partition_w
.
load
(
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
partition_w
.
release
(
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
class
TestCollectionString
(
TestcaseBase
):
"""
******************************************************************
The following cases are used to test about string
******************************************************************
"""
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
def
test_collection_string_field_is_primary
(
self
):
"""
target: test create collection with string field
method: 1. create collection with string field and vector field
2. set string fields is_primary=True
expected: Create collection successfully
"""
self
.
_connect
()
c_name
=
cf
.
gen_unique_str
(
prefix
)
schema
=
cf
.
gen_string_pk_default_collection_schema
()
self
.
collection_wrap
.
init_collection
(
name
=
c_name
,
schema
=
schema
,
check_task
=
CheckTasks
.
check_collection_property
,
check_items
=
{
exp_name
:
c_name
,
exp_schema
:
schema
})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
def
test_collection_with_muti_string_fields
(
self
):
"""
target: test create collection with muti string fields
method: 1. create collection with primary string field and not primary string field
2. string fields is_primary=True
expected: Create collection successfully
"""
self
.
_connect
()
c_name
=
cf
.
gen_unique_str
(
prefix
)
int_field
=
cf
.
gen_int64_field
()
vec_field
=
cf
.
gen_float_vec_field
()
string_field_1
=
cf
.
gen_string_field
(
is_primary
=
True
)
string_field_2
=
cf
.
gen_string_field
(
name
=
c_name
)
schema
=
cf
.
gen_collection_schema
(
fields
=
[
int_field
,
string_field_1
,
string_field_2
,
vec_field
])
self
.
collection_wrap
.
init_collection
(
name
=
c_name
,
schema
=
schema
,
check_task
=
CheckTasks
.
check_collection_property
,
check_items
=
{
exp_name
:
c_name
,
exp_schema
:
schema
})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
def
test_collection_only_string_field
(
self
):
"""
target: test create collection with one string field
method: create collection with only string field
expected: Raise exception
"""
self
.
_connect
()
string_field
=
cf
.
gen_string_field
(
is_primary
=
True
)
schema
=
cf
.
gen_collection_schema
([
string_field
])
error
=
{
ct
.
err_code
:
0
,
ct
.
err_msg
:
"No vector field is found"
}
self
.
collection_wrap
.
init_collection
(
name
=
cf
.
gen_unique_str
(
prefix
),
schema
=
schema
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
def
test_collection_string_field_with_exceed_max_len
(
self
):
"""
target: test create collection with string field
method: 1. create collection with string field
2. String field max_length_per_row exceeds maximum
expected: Raise exception
"""
self
.
_connect
()
c_name
=
cf
.
gen_unique_str
(
prefix
)
int_field
=
cf
.
gen_int64_field
(
is_primary
=
True
)
vec_field
=
cf
.
gen_float_vec_field
()
max_length
=
100000
string_field
=
cf
.
gen_string_field
(
max_length_per_row
=
max_length
)
schema
=
cf
.
gen_collection_schema
([
int_field
,
string_field
,
vec_field
])
error
=
{
ct
.
err_code
:
0
,
ct
.
err_msg
:
"invalid max_length_per_row: %s"
%
max_length
}
self
.
collection_wrap
.
init_collection
(
name
=
c_name
,
schema
=
schema
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
def
test_collection_invalid_string_field_dtype
(
self
):
"""
target: test create collection with string field
method: create collection with string field, the string field datatype is invaild
expected: Raise exception
"""
self
.
_connect
()
string_field
=
self
.
field_schema_wrap
.
init_field_schema
(
name
=
"string"
,
dtype
=
DataType
.
STRING
)[
0
]
int_field
=
cf
.
gen_int64_field
(
is_primary
=
True
)
vec_field
=
cf
.
gen_float_vec_field
()
schema
=
cf
.
gen_collection_schema
(
fields
=
[
int_field
,
string_field
,
vec_field
])
error
=
{
ct
.
err_code
:
0
,
ct
.
err_msg
:
"string data type not supported yet, please use VarChar type instead"
}
self
.
collection_wrap
.
init_collection
(
name
=
cf
.
gen_unique_str
(
prefix
),
schema
=
schema
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
def
test_collection_string_field_is_primary_and_auto_id
(
self
):
"""
target: test create collection with string field
method: create collection with string field, the string field primary and auto id are true
expected: Raise exception
"""
self
.
_connect
()
int_field
=
cf
.
gen_int64_field
()
vec_field
=
cf
.
gen_float_vec_field
()
string_field
=
cf
.
gen_string_field
(
is_primary
=
True
,
auto_id
=
True
)
fields
=
[
int_field
,
string_field
,
vec_field
]
schema
,
_
=
self
.
collection_schema_wrap
.
init_collection_schema
(
fields
=
fields
)
error
=
{
ct
.
err_code
:
0
,
ct
.
err_msg
:
"autoID is not supported when the VarChar field is the primary key"
}
self
.
collection_wrap
.
init_collection
(
name
=
cf
.
gen_unique_str
(
prefix
),
schema
=
schema
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录