Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
65309749
M
milvus
项目概览
milvus
/
milvus
10 个月 前同步成功
通知
260
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
65309749
编写于
6月 07, 2021
作者:
Y
yanliang567
提交者:
GitHub
6月 07, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[skip ci] Update check_items for ResponseChecker (#5649)
Signed-off-by:
N
yanliang567
<
yanliang.qiao@zilliz.com
>
上级
9d201b0b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
126 addition
and
110 deletion
+126
-110
tests20/python_client/base/client_base.py
tests20/python_client/base/client_base.py
+4
-4
tests20/python_client/base/collection_wrapper.py
tests20/python_client/base/collection_wrapper.py
+44
-43
tests20/python_client/base/partition_wrapper.py
tests20/python_client/base/partition_wrapper.py
+20
-22
tests20/python_client/check/func_check.py
tests20/python_client/check/func_check.py
+19
-19
tests20/python_client/testcases/test_partition.py
tests20/python_client/testcases/test_partition.py
+39
-22
未找到文件。
tests20/python_client/base/client_base.py
浏览文件 @
65309749
...
...
@@ -122,12 +122,12 @@ class TestcaseBase(Base):
return
collection_w
def
init_partition_wrap
(
self
,
collection_wrap
,
name
=
None
,
description
=
None
,
negative
=
False
,
check_task
=
None
,
**
kwargs
):
check_task
=
None
,
check_items
=
None
,
**
kwargs
):
name
=
cf
.
gen_unique_str
(
"partition_"
)
if
name
is
None
else
name
description
=
cf
.
gen_unique_str
(
"partition_des_"
)
if
description
is
None
else
description
collection_wrap
=
self
.
init_collection_wrap
()
if
collection_wrap
is
None
else
collection_wrap
partition_wrap
=
ApiPartitionWrapper
()
partition_wrap
.
init_partition
(
collection_wrap
.
collection
,
name
,
description
=
description
,
check_task
=
check_task
,
**
kwargs
)
partition_wrap
.
init_partition
(
collection_wrap
.
collection
,
name
,
description
,
check_task
=
check_task
,
check_items
=
check_items
,
**
kwargs
)
return
partition_wrap
tests20/python_client/base/collection_wrapper.py
浏览文件 @
65309749
...
...
@@ -9,97 +9,98 @@ from utils.api_request import api_request
class
ApiCollectionWrapper
:
collection
=
None
def
init_collection
(
self
,
name
,
data
=
None
,
schema
=
None
,
check_task
=
None
,
check_
para
ms
=
None
,
**
kwargs
):
def
init_collection
(
self
,
name
,
data
=
None
,
schema
=
None
,
check_task
=
None
,
check_
ite
ms
=
None
,
**
kwargs
):
""" In order to distinguish the same name of collection """
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
is_succ
=
api_request
([
Collection
,
name
,
data
,
schema
],
**
kwargs
)
self
.
collection
=
res
if
is_succ
else
None
check_result
=
ResponseChecker
(
res
,
func_name
,
check_task
,
check_params
,
is_succ
,
name
=
name
,
data
=
data
,
schema
=
schema
,
**
kwargs
).
run
()
check_result
=
ResponseChecker
(
res
,
func_name
,
check_task
,
check_items
,
is_succ
,
name
=
name
,
data
=
data
,
schema
=
schema
,
**
kwargs
).
run
()
return
res
,
check_result
@
property
def
schema
(
self
,
check_
res
=
None
,
check_para
ms
=
None
):
def
schema
(
self
,
check_
task
=
None
,
check_ite
ms
=
None
):
return
self
.
collection
.
schema
# func_name = sys._getframe().f_code.co_name
# res, check = func_req([self.collection.schema])
# check_result = CheckFunc(res, func_name, check_
res, check_para
ms, check).run()
# check_result = CheckFunc(res, func_name, check_
task, check_ite
ms, check).run()
# return res, check_result
@
property
def
description
(
self
,
check_
res
=
None
,
check_para
ms
=
None
):
def
description
(
self
,
check_
task
=
None
,
check_ite
ms
=
None
):
return
self
.
collection
.
description
# func_name = sys._getframe().f_code.co_name
# res, check = func_req([self.collection.description])
# check_result = CheckFunc(res, func_name, check_
res, check_para
ms, check).run()
# check_result = CheckFunc(res, func_name, check_
task, check_ite
ms, check).run()
# return res, check_result
@
property
def
name
(
self
,
check_
res
=
None
,
check_para
ms
=
None
):
def
name
(
self
,
check_
task
=
None
,
check_ite
ms
=
None
):
return
self
.
collection
.
name
# func_name = sys._getframe().f_code.co_name
# res, check = func_req([self.collection.name])
# check_result = CheckFunc(res, func_name, check_
res, check_para
ms, check).run()
# check_result = CheckFunc(res, func_name, check_
task, check_ite
ms, check).run()
# return res, check_result
@
property
def
is_empty
(
self
,
check_
res
=
None
,
check_para
ms
=
None
):
def
is_empty
(
self
,
check_
task
=
None
,
check_ite
ms
=
None
):
return
self
.
collection
.
is_empty
# func_name = sys._getframe().f_code.co_name
# res, check = func_req([self.collection.is_empty])
# check_result = CheckFunc(res, func_name, check_
res, check_para
ms, check).run()
# check_result = CheckFunc(res, func_name, check_
task, check_ite
ms, check).run()
# return res, check_result
@
property
def
num_entities
(
self
,
check_
res
=
None
,
check_para
ms
=
None
):
def
num_entities
(
self
,
check_
task
=
None
,
check_ite
ms
=
None
):
return
self
.
collection
.
num_entities
# func_name = sys._getframe().f_code.co_name
# res, check = func_req([self.collection.num_entities])
# check_result = CheckFunc(res, func_name, check_
res, check_para
ms, check).run()
# check_result = CheckFunc(res, func_name, check_
task, check_ite
ms, check).run()
# return res, check_result
@
property
def
primary_field
(
self
,
check_
res
=
None
,
check_para
ms
=
None
):
def
primary_field
(
self
,
check_
task
=
None
,
check_ite
ms
=
None
):
return
self
.
collection
.
primary_field
# func_name = sys._getframe().f_code.co_name
# res, check = func_req([self.collection.primary_field])
# check_result = CheckFunc(res, func_name, check_
res, check_para
ms, check).run()
# check_result = CheckFunc(res, func_name, check_
task, check_ite
ms, check).run()
# return res, check_result
def
drop
(
self
,
check_
res
=
None
,
check_para
ms
=
None
,
**
kwargs
):
def
drop
(
self
,
check_
task
=
None
,
check_ite
ms
=
None
,
**
kwargs
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
check
=
api_request
([
self
.
collection
.
drop
],
**
kwargs
)
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
res
,
check_para
ms
,
check
,
**
kwargs
).
run
()
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
task
,
check_ite
ms
,
check
,
**
kwargs
).
run
()
return
res
,
check_result
def
load
(
self
,
field_names
=
None
,
index_names
=
None
,
partition_names
=
None
,
check_
res
=
None
,
check_para
ms
=
None
,
**
kwargs
):
def
load
(
self
,
field_names
=
None
,
index_names
=
None
,
partition_names
=
None
,
check_
task
=
None
,
check_ite
ms
=
None
,
**
kwargs
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
check
=
api_request
([
self
.
collection
.
load
,
field_names
,
index_names
,
partition_names
],
**
kwargs
)
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
res
,
check_para
ms
,
check
,
field_names
=
field_names
,
index_names
=
index_names
,
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
task
,
check_ite
ms
,
check
,
field_names
=
field_names
,
index_names
=
index_names
,
partition_names
=
partition_names
,
**
kwargs
).
run
()
return
res
,
check_result
def
release
(
self
,
check_
res
=
None
,
check_para
ms
=
None
,
**
kwargs
):
def
release
(
self
,
check_
task
=
None
,
check_ite
ms
=
None
,
**
kwargs
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
check
=
api_request
([
self
.
collection
.
release
],
**
kwargs
)
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
res
,
check_
para
ms
,
check
,
**
kwargs
).
run
()
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
task
,
check_
ite
ms
,
check
,
**
kwargs
).
run
()
return
res
,
check_result
def
insert
(
self
,
data
,
partition_name
=
None
,
check_
res
=
None
,
check_para
ms
=
None
,
**
kwargs
):
def
insert
(
self
,
data
,
partition_name
=
None
,
check_
task
=
None
,
check_ite
ms
=
None
,
**
kwargs
):
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_
res
,
check_para
ms
,
check
,
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
task
,
check_ite
ms
,
check
,
dat
=
data
,
partition_name
=
partition_name
,
**
kwargs
).
run
()
return
res
,
check_result
def
search
(
self
,
data
,
anns_field
,
param
,
limit
,
expression
,
partition_names
=
None
,
output_fields
=
None
,
timeout
=
None
,
check_
res
=
None
,
check_para
ms
=
None
,
**
kwargs
):
check_
task
=
None
,
check_ite
ms
=
None
,
**
kwargs
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
check
=
api_request
([
self
.
collection
.
search
,
data
,
anns_field
,
param
,
limit
,
expression
,
partition_names
,
output_fields
,
timeout
],
**
kwargs
)
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
res
,
check_para
ms
,
check
,
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
task
,
check_ite
ms
,
check
,
data
=
data
,
anns_field
=
anns_field
,
param
=
param
,
limit
=
limit
,
expression
=
expression
,
partition_names
=
partition_names
,
output_fields
=
output_fields
,
...
...
@@ -107,62 +108,62 @@ class ApiCollectionWrapper:
return
res
,
check_result
@
property
def
partitions
(
self
,
check_
res
=
None
,
check_para
ms
=
None
):
def
partitions
(
self
,
check_
task
=
None
,
check_ite
ms
=
None
):
return
self
.
collection
.
partitions
# func_name = sys._getframe().f_code.co_name
# res, check = func_req([self.collection.partitions])
# check_result = CheckFunc(res, func_name, check_
res, check_para
ms, check).run()
# check_result = CheckFunc(res, func_name, check_
task, check_ite
ms, check).run()
# return res, check_result
def
partition
(
self
,
partition_name
,
check_task
=
None
,
check_
para
ms
=
None
):
def
partition
(
self
,
partition_name
,
check_task
=
None
,
check_
ite
ms
=
None
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
succ
=
api_request
([
self
.
collection
.
partition
,
partition_name
])
check_result
=
ResponseChecker
(
res
,
func_name
,
check_task
,
check_
para
ms
,
check_result
=
ResponseChecker
(
res
,
func_name
,
check_task
,
check_
ite
ms
,
succ
,
partition_name
=
partition_name
).
run
()
return
res
,
check_result
def
has_partition
(
self
,
partition_name
,
check_task
=
None
,
check_
para
ms
=
None
):
def
has_partition
(
self
,
partition_name
,
check_task
=
None
,
check_
ite
ms
=
None
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
succ
=
api_request
([
self
.
collection
.
has_partition
,
partition_name
])
check_result
=
ResponseChecker
(
res
,
func_name
,
check_task
,
check_
para
ms
,
check_result
=
ResponseChecker
(
res
,
func_name
,
check_task
,
check_
ite
ms
,
succ
,
partition_name
=
partition_name
).
run
()
return
res
,
check_result
def
drop_partition
(
self
,
partition_name
,
check_
res
=
None
,
check_para
ms
=
None
,
**
kwargs
):
def
drop_partition
(
self
,
partition_name
,
check_
task
=
None
,
check_ite
ms
=
None
,
**
kwargs
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
check
=
api_request
([
self
.
collection
.
drop_partition
,
partition_name
],
**
kwargs
)
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
res
,
check_para
ms
,
check
,
partition_name
=
partition_name
,
**
kwargs
).
run
()
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
task
,
check_ite
ms
,
check
,
partition_name
=
partition_name
,
**
kwargs
).
run
()
return
res
,
check_result
@
property
def
indexes
(
self
,
check_
res
=
None
,
check_para
ms
=
None
):
def
indexes
(
self
,
check_
task
=
None
,
check_ite
ms
=
None
):
return
self
.
collection
.
indexes
# func_name = sys._getframe().f_code.co_name
# res, check = func_req([self.collection.indexes])
# check_result = CheckFunc(res, func_name, check_
res, check_para
ms, check).run()
# check_result = CheckFunc(res, func_name, check_
task, check_ite
ms, check).run()
# return res, check_result
def
index
(
self
,
index_name
=
""
,
check_
res
=
None
,
check_para
ms
=
None
):
def
index
(
self
,
index_name
=
""
,
check_
task
=
None
,
check_ite
ms
=
None
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
check
=
api_request
([
self
.
collection
.
index
,
index_name
])
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
res
,
check_para
ms
,
check
,
index_name
=
index_name
).
run
()
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
task
,
check_ite
ms
,
check
,
index_name
=
index_name
).
run
()
return
res
,
check_result
def
create_index
(
self
,
field_name
,
index_params
,
index_name
=
""
,
check_
res
=
None
,
check_para
ms
=
None
,
**
kwargs
):
def
create_index
(
self
,
field_name
,
index_params
,
index_name
=
""
,
check_
task
=
None
,
check_ite
ms
=
None
,
**
kwargs
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
check
=
api_request
([
self
.
collection
.
create_index
,
field_name
,
index_params
,
index_name
],
**
kwargs
)
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
res
,
check_para
ms
,
check
,
field_name
=
field_name
,
index_params
=
index_params
,
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
task
,
check_ite
ms
,
check
,
field_name
=
field_name
,
index_params
=
index_params
,
index_name
=
index_name
,
**
kwargs
).
run
()
return
res
,
check_result
def
has_index
(
self
,
index_name
=
""
,
check_
res
=
None
,
check_para
ms
=
None
):
def
has_index
(
self
,
index_name
=
""
,
check_
task
=
None
,
check_ite
ms
=
None
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
check
=
api_request
([
self
.
collection
.
has_index
,
index_name
])
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
res
,
check_para
ms
,
check
,
index_name
=
index_name
).
run
()
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
task
,
check_ite
ms
,
check
,
index_name
=
index_name
).
run
()
return
res
,
check_result
def
drop_index
(
self
,
index_name
=
""
,
check_
res
=
None
,
check_para
ms
=
None
,
**
kwargs
):
def
drop_index
(
self
,
index_name
=
""
,
check_
task
=
None
,
check_ite
ms
=
None
,
**
kwargs
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
check
=
api_request
([
self
.
collection
.
drop_index
,
index_name
],
**
kwargs
)
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
res
,
check_para
ms
,
check
,
index_name
=
index_name
,
**
kwargs
).
run
()
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
task
,
check_ite
ms
,
check
,
index_name
=
index_name
,
**
kwargs
).
run
()
return
res
,
check_result
tests20/python_client/base/partition_wrapper.py
浏览文件 @
65309749
...
...
@@ -10,87 +10,85 @@ class ApiPartitionWrapper:
partition
=
None
def
init_partition
(
self
,
collection
,
name
,
description
=
""
,
check_task
=
None
,
check_
para
ms
=
None
,
**
kwargs
):
check_task
=
None
,
check_
ite
ms
=
None
,
**
kwargs
):
""" In order to distinguish the same name of partition """
func_name
=
sys
.
_getframe
().
f_code
.
co_name
response
,
is_succ
=
api_request
([
Partition
,
collection
,
name
,
description
],
**
kwargs
)
self
.
partition
=
response
if
is_succ
is
True
else
None
check_result
=
ResponseChecker
(
response
,
func_name
,
check_task
,
check_params
,
is_succ
,
collection
=
collection
,
name
=
name
,
description
=
description
,
is_empty
=
True
,
num_entities
=
0
,
check_result
=
ResponseChecker
(
response
,
func_name
,
check_task
,
check_items
,
is_succ
,
**
kwargs
).
run
()
return
response
,
check_result
@
property
def
description
(
self
,
check_
res
=
None
,
check_para
ms
=
None
):
def
description
(
self
,
check_
task
=
None
,
check_ite
ms
=
None
):
return
self
.
partition
.
description
if
self
.
partition
else
None
# func_name = sys._getframe().f_code.co_name
# res, check = func_req([self.partition.description])
# check_result = CheckFunc(res, func_name, check_
res, check_para
ms, check).run()
# check_result = CheckFunc(res, func_name, check_
task, check_ite
ms, check).run()
# return res, check_result
@
property
def
name
(
self
,
check_
res
=
None
,
check_para
ms
=
None
):
def
name
(
self
,
check_
task
=
None
,
check_ite
ms
=
None
):
return
self
.
partition
.
name
if
self
.
partition
else
None
# func_name = sys._getframe().f_code.co_name
# res, check = func_req([self.partition.name])
# check_result = CheckFunc(res, func_name, check_
res, check_para
ms, check).run()
# check_result = CheckFunc(res, func_name, check_
task, check_ite
ms, check).run()
# return res, check_result
@
property
def
is_empty
(
self
,
check_
res
=
None
,
check_para
ms
=
None
):
def
is_empty
(
self
,
check_
task
=
None
,
check_ite
ms
=
None
):
return
self
.
partition
.
is_empty
if
self
.
partition
else
None
# func_name = sys._getframe().f_code.co_name
# res, check = func_req([self.partition.is_empty])
# check_result = CheckFunc(res, func_name, check_
res, check_para
ms, check).run()
# check_result = CheckFunc(res, func_name, check_
task, check_ite
ms, check).run()
# return res, check_result
@
property
def
num_entities
(
self
,
check_
res
=
None
,
check_para
ms
=
None
):
def
num_entities
(
self
,
check_
task
=
None
,
check_ite
ms
=
None
):
return
self
.
partition
.
num_entities
if
self
.
partition
else
None
# func_name = sys._getframe().f_code.co_name
# res, check = func_req([self.partition.num_entities])
# check_result = CheckFunc(res, func_name, check_
res, check_para
ms, check).run()
# check_result = CheckFunc(res, func_name, check_
task, check_ite
ms, check).run()
# return res, check_result
def
drop
(
self
,
check_task
=
None
,
check_
para
ms
=
None
,
**
kwargs
):
def
drop
(
self
,
check_task
=
None
,
check_
ite
ms
=
None
,
**
kwargs
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
succ
=
api_request
([
self
.
partition
.
drop
],
**
kwargs
)
check_result
=
ResponseChecker
(
res
,
func_name
,
check_task
,
check_
para
ms
,
succ
,
**
kwargs
).
run
()
check_result
=
ResponseChecker
(
res
,
func_name
,
check_task
,
check_
ite
ms
,
succ
,
**
kwargs
).
run
()
return
res
,
check_result
def
load
(
self
,
field_names
=
None
,
index_names
=
None
,
check_task
=
None
,
check_
para
ms
=
None
,
**
kwargs
):
def
load
(
self
,
field_names
=
None
,
index_names
=
None
,
check_task
=
None
,
check_
ite
ms
=
None
,
**
kwargs
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
succ
=
api_request
([
self
.
partition
.
load
,
field_names
,
index_names
],
**
kwargs
)
check_result
=
ResponseChecker
(
res
,
func_name
,
check_task
,
check_
para
ms
,
is_succ
=
succ
,
check_
ite
ms
,
is_succ
=
succ
,
field_names
=
field_names
,
index_names
=
index_names
,
**
kwargs
).
run
()
return
res
,
check_result
def
release
(
self
,
check_task
=
None
,
check_
para
ms
=
None
,
**
kwargs
):
def
release
(
self
,
check_task
=
None
,
check_
ite
ms
=
None
,
**
kwargs
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
succ
=
api_request
([
self
.
partition
.
release
],
**
kwargs
)
check_result
=
ResponseChecker
(
res
,
func_name
,
check_task
,
check_
para
ms
,
is_succ
=
succ
,
check_
ite
ms
,
is_succ
=
succ
,
**
kwargs
).
run
()
return
res
,
check_result
def
insert
(
self
,
data
,
check_task
=
None
,
check_
para
ms
=
None
,
**
kwargs
):
def
insert
(
self
,
data
,
check_task
=
None
,
check_
ite
ms
=
None
,
**
kwargs
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
succ
=
api_request
([
self
.
partition
.
insert
,
data
],
**
kwargs
)
check_result
=
ResponseChecker
(
res
,
func_name
,
check_task
,
check_
para
ms
,
is_succ
=
succ
,
data
=
data
,
check_
ite
ms
,
is_succ
=
succ
,
data
=
data
,
**
kwargs
).
run
()
return
res
,
check_result
def
search
(
self
,
data
,
anns_field
,
params
,
limit
,
expr
=
None
,
output_fields
=
None
,
check_task
=
None
,
check_
para
ms
=
None
,
**
kwargs
):
check_task
=
None
,
check_
ite
ms
=
None
,
**
kwargs
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
succ
=
api_request
([
self
.
partition
.
search
,
data
,
anns_field
,
params
,
limit
,
expr
,
output_fields
],
**
kwargs
)
check_result
=
ResponseChecker
(
res
,
func_name
,
check_task
,
check_
para
ms
,
check_result
=
ResponseChecker
(
res
,
func_name
,
check_task
,
check_
ite
ms
,
is_succ
=
succ
,
data
=
data
,
anns_field
=
anns_field
,
params
=
params
,
limit
=
limit
,
expr
=
expr
,
output_fields
=
output_fields
,
**
kwargs
).
run
()
...
...
tests20/python_client/check/func_check.py
浏览文件 @
65309749
...
...
@@ -6,14 +6,14 @@ from utils.api_request import Error
class
ResponseChecker
:
def
__init__
(
self
,
response
,
func_name
,
check_task
,
check_
para
ms
,
is_succ
=
True
,
**
kwargs
):
def
__init__
(
self
,
response
,
func_name
,
check_task
,
check_
ite
ms
,
is_succ
=
True
,
**
kwargs
):
self
.
response
=
response
# response of api request
self
.
func_name
=
func_name
# api function name
self
.
check_task
=
check_task
# task to check response of the api request
self
.
check_items
=
check_
para
ms
# check items and expectations that to be checked in check task
self
.
check_items
=
check_
ite
ms
# check items and expectations that to be checked in check task
self
.
succ
=
is_succ
# api responses successful or not
self
.
kwargs_dict
=
{}
# not used for now, just for ext
ant
ion
self
.
kwargs_dict
=
{}
# not used for now, just for ext
ens
ion
for
key
,
value
in
kwargs
.
items
():
self
.
kwargs_dict
[
key
]
=
value
self
.
keys
=
self
.
kwargs_dict
.
keys
()
...
...
@@ -33,10 +33,10 @@ class ResponseChecker:
result
=
self
.
check_list_count
(
self
.
response
,
self
.
func_name
,
self
.
check_items
)
elif
self
.
check_task
==
CheckTasks
.
check_collection_property
:
result
=
self
.
check_collection_property
(
self
.
response
,
self
.
func_name
,
self
.
kwargs_dict
)
result
=
self
.
check_collection_property
(
self
.
response
,
self
.
func_name
,
self
.
check_items
)
elif
self
.
check_task
==
CheckTasks
.
check_partition_property
:
result
=
self
.
check_partition_property
(
self
.
response
,
self
.
func_name
,
self
.
kwargs_dict
)
result
=
self
.
check_partition_property
(
self
.
response
,
self
.
func_name
,
self
.
check_items
)
# Add check_items here if something new need verify
...
...
@@ -77,33 +77,33 @@ class ResponseChecker:
return
True
@
staticmethod
def
check_collection_property
(
collection
,
func_name
,
para
ms
):
def
check_collection_property
(
collection
,
func_name
,
check_ite
ms
):
exp_func_name
=
"collection_init"
if
func_name
!=
exp_func_name
:
log
.
warning
(
"The function name is {} rather than {}"
.
format
(
func_name
,
exp_func_name
))
if
not
isinstance
(
collection
,
Collection
):
raise
Exception
(
"The result to check isn't collection type object"
)
assert
collection
.
name
==
para
ms
[
"name"
]
assert
collection
.
description
==
para
ms
[
"schema"
].
description
assert
collection
.
schema
==
para
ms
[
"schema"
]
assert
collection
.
name
==
check_ite
ms
[
"name"
]
assert
collection
.
description
==
check_ite
ms
[
"schema"
].
description
assert
collection
.
schema
==
check_ite
ms
[
"schema"
]
return
True
@
staticmethod
def
check_partition_property
(
partition
,
func_name
,
para
ms
):
def
check_partition_property
(
partition
,
func_name
,
check_ite
ms
):
exp_func_name
=
"_init_partition"
if
func_name
!=
exp_func_name
:
log
.
warning
(
"The function name is {} rather than {}"
.
format
(
func_name
,
exp_func_name
))
if
not
isinstance
(
partition
,
Partition
):
raise
Exception
(
"The result to check isn't partition type object"
)
if
len
(
para
ms
)
==
0
:
if
len
(
check_ite
ms
)
==
0
:
raise
Exception
(
"No expect values found in the check task"
)
if
para
ms
[
"name"
]:
assert
partition
.
name
==
para
ms
[
"name"
]
if
para
ms
[
"description"
]:
assert
partition
.
description
==
para
ms
[
"description"
]
if
para
ms
[
"is_empty"
]:
assert
partition
.
is_empty
==
para
ms
[
"is_empty"
]
if
para
ms
[
"num_entities"
]:
assert
partition
.
num_entities
==
para
ms
[
"num_entities"
]
if
check_ite
ms
[
"name"
]:
assert
partition
.
name
==
check_ite
ms
[
"name"
]
if
check_ite
ms
[
"description"
]:
assert
partition
.
description
==
check_ite
ms
[
"description"
]
if
check_ite
ms
[
"is_empty"
]:
assert
partition
.
is_empty
==
check_ite
ms
[
"is_empty"
]
if
check_ite
ms
[
"num_entities"
]:
assert
partition
.
num_entities
==
check_ite
ms
[
"num_entities"
]
return
True
tests20/python_client/testcases/test_partition.py
浏览文件 @
65309749
...
...
@@ -28,7 +28,10 @@ class TestPartitionParams(TestcaseBase):
# create partition
self
.
init_partition_wrap
(
collection_w
,
partition_name
,
description
=
description
,
check_task
=
CheckTasks
.
check_partition_property
)
check_task
=
CheckTasks
.
check_partition_property
,
check_items
=
{
"name"
:
partition_name
,
"description"
:
description
,
"is_empty"
:
True
,
"num_entities"
:
0
}
)
# check that the partition has been created
assert
collection_w
.
has_partition
(
partition_name
)[
0
]
...
...
@@ -41,15 +44,13 @@ class TestPartitionParams(TestcaseBase):
method: 1. create a partition empty none name
expected: 1. raise exception
"""
self
.
collection_wrap
.
init_collection
()
# create a collection
collection_w
=
self
.
init_collection_wrap
()
# create partition
self
.
partition_wrap
.
init_partition
(
collection_w
.
collection
,
partition_name
,
check_task
=
CheckTasks
.
err_res
,
err_code
=
1
,
err_msg
=
"Partition tag should not be empty"
)
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"Partition tag should not be empty"
}
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
parametrize
(
"partition_name, description"
,
[(
cf
.
gen_unique_str
(
prefix
),
""
)])
...
...
@@ -65,7 +66,10 @@ class TestPartitionParams(TestcaseBase):
# init partition
self
.
init_partition_wrap
(
collection_w
,
partition_name
,
description
=
description
,
check_task
=
CheckTasks
.
check_partition_property
)
check_task
=
CheckTasks
.
check_partition_property
,
check_items
=
{
"name"
:
partition_name
,
"description"
:
description
,
"is_empty"
:
True
,
"num_entities"
:
0
}
)
# check that the partition has been created
assert
collection_w
.
has_partition
(
partition_name
)[
0
]
...
...
@@ -107,7 +111,10 @@ class TestPartitionParams(TestcaseBase):
# create partition
self
.
init_partition_wrap
(
collection_w
,
partition_name
,
description
=
description
,
check_task
=
CheckTasks
.
check_partition_property
)
check_task
=
CheckTasks
.
check_partition_property
,
check_items
=
{
"name"
:
partition_name
,
"description"
:
description
,
"is_empty"
:
True
,
"num_entities"
:
0
}
)
assert
collection_w
.
has_partition
(
partition_name
)[
0
]
assert
collection_w
.
description
==
description
...
...
@@ -147,7 +154,7 @@ class TestPartitionParams(TestcaseBase):
# create partition
self
.
partition_wrap
.
init_partition
(
self
.
collection_wrap
.
collection
,
partition_name
,
check_task
=
CheckTasks
.
err_res
,
check_
params
=
{
'err_code'
:
1
,
'err_msg'
:
"is illegal"
}
check_
items
=
{
"err_code"
:
1
,
'err_msg'
:
"is illegal"
}
)
# TODO: need an error code issue #5144 and assert independently
...
...
@@ -162,7 +169,7 @@ class TestPartitionParams(TestcaseBase):
# create partition with collection is None
self
.
partition_wrap
.
init_partition
(
collection
=
None
,
name
=
partition_name
,
check_task
=
CheckTasks
.
err_res
,
err_code
=
1
,
err_msg
=
"'NoneType' object has no attribute"
)
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"'NoneType' object has no attribute"
}
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L0
)
@
pytest
.
mark
.
parametrize
(
"partition_name"
,
[
cf
.
gen_unique_str
(
prefix
)])
...
...
@@ -258,7 +265,9 @@ class TestPartitionParams(TestcaseBase):
# create partition
partition_w
=
self
.
init_partition_wrap
(
collection_w
,
partition_name
,
check_task
=
CheckTasks
.
check_partition_property
,
is_empty
=
True
,
num_entities
=
0
)
check_items
=
{
"name"
:
partition_name
,
"is_empty"
:
True
,
"num_entities"
:
0
}
)
# insert data
partition_w
.
insert
(
data
)
...
...
@@ -295,7 +304,7 @@ class TestPartitionOperations(TestcaseBase):
# create partition failed
self
.
partition_wrap
.
init_partition
(
collection_w
.
collection
,
partition_name
,
check_task
=
CheckTasks
.
err_res
,
err_code
=
1
,
err_msg
=
"can't find collection"
)
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"can't find collection"
}
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
parametrize
(
"partition_name"
,
[
cf
.
gen_unique_str
(
prefix
)])
...
...
@@ -360,10 +369,11 @@ class TestPartitionOperations(TestcaseBase):
for
t
in
threads
:
t
.
join
()
p_name
=
cf
.
gen_unique_str
()
self
.
partition_wrap
.
init_partition
(
m_collection
,
p_name
,
check_task
=
CheckTasks
.
err_res
,
err_code
=
1
,
err_msg
=
"maximum partition's number should be limit to 4096"
)
self
.
partition_wrap
.
init_partition
(
m_collection
,
p_name
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"maximum partition's number should be limit to 4096"
})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
xfail
(
reason
=
"issue #5302"
)
...
...
@@ -381,7 +391,8 @@ class TestPartitionOperations(TestcaseBase):
partition_w
=
collection_w
.
partition
(
ct
.
default_partition_name
)
# verify that drop partition with error
partition_w
.
drop
(
check_task
=
CheckTasks
.
err_res
,
err_code
=
1
,
err_msg
=
"not"
)
partition_w
.
drop
(
check_task
=
CheckTasks
.
err_res
,
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"not"
})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
parametrize
(
"partition_name"
,
[
cf
.
gen_unique_str
(
prefix
)])
...
...
@@ -405,7 +416,8 @@ class TestPartitionOperations(TestcaseBase):
assert
not
collection_w
.
has_partition
(
partition_name
)
# verify that drop the partition again with exception
partition_w
.
drop
(
check_task
=
CheckTasks
.
err_res
,
err_code
=
1
,
err_msg
=
"None Type"
)
partition_w
.
drop
(
check_task
=
CheckTasks
.
err_res
,
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"None Type"
})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
parametrize
(
"partition_name"
,
[
cf
.
gen_unique_str
(
prefix
)])
...
...
@@ -529,7 +541,8 @@ class TestPartitionOperations(TestcaseBase):
partition_w
.
drop
()
# release the dropped partition and check err response
partition_w
.
release
(
check_task
=
CheckTasks
.
err_res
,
err_code
=
1
,
err_msg
=
"None Type"
)
partition_w
.
release
(
check_task
=
CheckTasks
.
err_res
,
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"None Type"
})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
parametrize
(
"partition_name"
,
[
cf
.
gen_unique_str
(
prefix
)])
...
...
@@ -552,7 +565,8 @@ class TestPartitionOperations(TestcaseBase):
collection_w
.
drop
()
# release the partition and check err response
partition_w
.
release
(
check_task
=
CheckTasks
.
err_res
,
err_code
=
1
,
err_msg
=
"None Type"
)
partition_w
.
release
(
check_task
=
CheckTasks
.
err_res
,
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"None Type"
})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
xfail
(
reason
=
"issue #5384"
)
...
...
@@ -635,7 +649,8 @@ class TestPartitionOperations(TestcaseBase):
# insert data to partition
partition_w
.
insert
(
cf
.
gen_default_dataframe_data
(),
check_task
=
CheckTasks
.
err_res
,
err_code
=
1
,
err_msg
=
"not"
)
check_task
=
CheckTasks
.
err_res
,
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"not"
})
# TODO: update the assert error
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
...
...
@@ -658,8 +673,9 @@ class TestPartitionOperations(TestcaseBase):
collection_w
.
drop
()
# insert data to partition
partition_w
.
insert
(
cf
.
gen_default_dataframe_data
(),
check_task
=
CheckTasks
.
err_res
,
err_code
=
1
,
err_msg
=
"None Type"
)
partition_w
.
insert
(
cf
.
gen_default_dataframe_data
(),
check_task
=
CheckTasks
.
err_res
,
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"None Type"
})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
xfail
(
reason
=
"issue #5302"
)
...
...
@@ -695,7 +711,8 @@ class TestPartitionOperations(TestcaseBase):
data
=
cf
.
gen_default_list_data
(
nb
=
10
,
dim
=
dim
)
# insert data to partition
partition_w
.
insert
(
data
,
check_task
=
CheckTasks
.
err_res
,
err_code
=
1
,
err_msg
=
"blabla"
)
partition_w
.
insert
(
data
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"blabla"
})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
parametrize
(
"sync"
,
[
True
,
False
])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录