Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
bc3e0619
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,发现更多精彩内容 >>
未验证
提交
bc3e0619
编写于
6月 08, 2021
作者:
Y
yanliang567
提交者:
GitHub
6月 08, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[skip ci] update partition tests (#5656)
Signed-off-by:
N
yanliang567
<
yanliang.qiao@zilliz.com
>
上级
79e43ddb
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
89 addition
and
41 deletion
+89
-41
tests20/python_client/base/client_base.py
tests20/python_client/base/client_base.py
+5
-2
tests20/python_client/base/connections_wrapper.py
tests20/python_client/base/connections_wrapper.py
+3
-3
tests20/python_client/check/func_check.py
tests20/python_client/check/func_check.py
+14
-10
tests20/python_client/common/common_func.py
tests20/python_client/common/common_func.py
+4
-0
tests20/python_client/testcases/test_connection.py
tests20/python_client/testcases/test_connection.py
+3
-3
tests20/python_client/testcases/test_partition.py
tests20/python_client/testcases/test_partition.py
+60
-23
未找到文件。
tests20/python_client/base/client_base.py
浏览文件 @
bc3e0619
...
@@ -98,8 +98,11 @@ class TestcaseBase(Base):
...
@@ -98,8 +98,11 @@ class TestcaseBase(Base):
def
_connect
(
self
):
def
_connect
(
self
):
""" Add an connection and create the connect """
""" Add an connection and create the connect """
self
.
connection_wrap
.
add_connection
(
default
=
{
"host"
:
param_info
.
param_host
,
"port"
:
param_info
.
param_port
})
self
.
connection_wrap
.
add_connection
(
default
=
{
"host"
:
param_info
.
param_host
,
"port"
:
param_info
.
param_port
})
res
,
_
=
self
.
connection_wrap
.
connect
(
alias
=
'default'
)
res
,
is_succ
=
self
.
connection_wrap
.
connect
(
alias
=
'default'
)
if
not
is_succ
:
raise
res
return
res
return
res
'''
'''
def _collection(self, **kwargs):
def _collection(self, **kwargs):
""" Init a collection and return the object of collection """
""" Init a collection and return the object of collection """
...
@@ -121,7 +124,7 @@ class TestcaseBase(Base):
...
@@ -121,7 +124,7 @@ class TestcaseBase(Base):
check_task
=
check_task
,
**
kwargs
)
check_task
=
check_task
,
**
kwargs
)
return
collection_w
return
collection_w
def
init_partition_wrap
(
self
,
collection_wrap
,
name
=
None
,
description
=
None
,
def
init_partition_wrap
(
self
,
collection_wrap
=
None
,
name
=
None
,
description
=
None
,
check_task
=
None
,
check_items
=
None
,
**
kwargs
):
check_task
=
None
,
check_items
=
None
,
**
kwargs
):
name
=
cf
.
gen_unique_str
(
"partition_"
)
if
name
is
None
else
name
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
description
=
cf
.
gen_unique_str
(
"partition_des_"
)
if
description
is
None
else
description
...
...
tests20/python_client/base/connections_wrapper.py
浏览文件 @
bc3e0619
...
@@ -30,10 +30,10 @@ class ApiConnectionsWrapper:
...
@@ -30,10 +30,10 @@ class ApiConnectionsWrapper:
check_result
=
ResponseChecker
(
res
,
func_name
,
check_res
,
check_params
,
check
,
alias
=
alias
).
run
()
check_result
=
ResponseChecker
(
res
,
func_name
,
check_res
,
check_params
,
check
,
alias
=
alias
).
run
()
return
res
,
check_result
return
res
,
check_result
def
connect
(
self
,
alias
=
DefaultConfig
.
DEFAULT_USING
,
check_
res
=
None
,
check_para
ms
=
None
,
**
kwargs
):
def
connect
(
self
,
alias
=
DefaultConfig
.
DEFAULT_USING
,
check_
task
=
None
,
check_ite
ms
=
None
,
**
kwargs
):
func_name
=
sys
.
_getframe
().
f_code
.
co_name
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
check
=
api_request
([
self
.
connection
.
connect
,
alias
],
**
kwargs
)
res
,
succ
=
api_request
([
self
.
connection
.
connect
,
alias
],
**
kwargs
)
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
res
,
check_params
,
check
,
alias
=
alias
,
**
kwargs
).
run
()
check_result
=
ResponseChecker
(
res
,
func_name
,
check_
task
,
check_items
,
succ
,
alias
=
alias
,
**
kwargs
).
run
()
return
res
,
check_result
return
res
,
check_result
def
get_connection
(
self
,
alias
=
DefaultConfig
.
DEFAULT_USING
,
check_res
=
None
,
check_params
=
None
):
def
get_connection
(
self
,
alias
=
DefaultConfig
.
DEFAULT_USING
,
check_res
=
None
,
check_params
=
None
):
...
...
tests20/python_client/check/func_check.py
浏览文件 @
bc3e0619
...
@@ -52,9 +52,9 @@ class ResponseChecker:
...
@@ -52,9 +52,9 @@ class ResponseChecker:
assert
actual
is
False
assert
actual
is
False
assert
len
(
error_dict
)
>
0
assert
len
(
error_dict
)
>
0
if
isinstance
(
res
,
Error
):
if
isinstance
(
res
,
Error
):
err_code
=
error_dict
[
"err_code"
]
#
err_code = error_dict["err_code"]
assert
res
.
code
==
err_code
or
ErrorMessage
[
err_code
]
in
res
.
message
#
assert res.code == err_code or ErrorMessage[err_code] in res.message
#
assert res.code == error_dict["err_code"] or error_dict["err_msg"] in res.message
assert
res
.
code
==
error_dict
[
"err_code"
]
or
error_dict
[
"err_msg"
]
in
res
.
message
else
:
else
:
log
.
error
(
"[CheckFunc] Response of API is not an error: %s"
%
str
(
res
))
log
.
error
(
"[CheckFunc] Response of API is not an error: %s"
%
str
(
res
))
assert
False
assert
False
...
@@ -83,7 +83,11 @@ class ResponseChecker:
...
@@ -83,7 +83,11 @@ class ResponseChecker:
log
.
warning
(
"The function name is {} rather than {}"
.
format
(
func_name
,
exp_func_name
))
log
.
warning
(
"The function name is {} rather than {}"
.
format
(
func_name
,
exp_func_name
))
if
not
isinstance
(
collection
,
Collection
):
if
not
isinstance
(
collection
,
Collection
):
raise
Exception
(
"The result to check isn't collection type object"
)
raise
Exception
(
"The result to check isn't collection type object"
)
if
len
(
check_items
)
==
0
:
raise
Exception
(
"No expect values found in the check task"
)
if
check_items
.
get
(
"name"
,
None
):
assert
collection
.
name
==
check_items
[
"name"
]
assert
collection
.
name
==
check_items
[
"name"
]
if
check_items
.
get
(
"schema"
,
None
):
assert
collection
.
description
==
check_items
[
"schema"
].
description
assert
collection
.
description
==
check_items
[
"schema"
].
description
assert
collection
.
schema
==
check_items
[
"schema"
]
assert
collection
.
schema
==
check_items
[
"schema"
]
return
True
return
True
...
@@ -97,13 +101,13 @@ class ResponseChecker:
...
@@ -97,13 +101,13 @@ class ResponseChecker:
raise
Exception
(
"The result to check isn't partition type object"
)
raise
Exception
(
"The result to check isn't partition type object"
)
if
len
(
check_items
)
==
0
:
if
len
(
check_items
)
==
0
:
raise
Exception
(
"No expect values found in the check task"
)
raise
Exception
(
"No expect values found in the check task"
)
if
check_items
[
"name"
]
:
if
check_items
.
get
(
"name"
,
None
)
:
assert
partition
.
name
==
check_items
[
"name"
]
assert
partition
.
name
==
check_items
[
"name"
]
if
check_items
[
"description"
]
:
if
check_items
.
get
(
"description"
,
None
)
:
assert
partition
.
description
==
check_items
[
"description"
]
assert
partition
.
description
==
check_items
[
"description"
]
if
check_items
[
"is_empty"
]
:
if
check_items
.
get
(
"is_empty"
,
None
)
:
assert
partition
.
is_empty
==
check_items
[
"is_empty"
]
assert
partition
.
is_empty
==
check_items
[
"is_empty"
]
if
check_items
[
"num_entities"
]
:
if
check_items
.
get
(
"num_entities"
,
None
)
:
assert
partition
.
num_entities
==
check_items
[
"num_entities"
]
assert
partition
.
num_entities
==
check_items
[
"num_entities"
]
return
True
return
True
tests20/python_client/common/common_func.py
浏览文件 @
bc3e0619
...
@@ -22,6 +22,10 @@ def gen_unique_str(str_value=None):
...
@@ -22,6 +22,10 @@ def gen_unique_str(str_value=None):
return
"test_"
+
prefix
if
str_value
is
None
else
str_value
+
"_"
+
prefix
return
"test_"
+
prefix
if
str_value
is
None
else
str_value
+
"_"
+
prefix
def
gen_str_by_length
(
length
=
8
):
return
""
.
join
(
random
.
choice
(
string
.
ascii_letters
+
string
.
digits
)
for
_
in
range
(
length
))
def
gen_int64_field
(
name
=
ct
.
default_int64_field_name
,
is_primary
=
False
,
description
=
ct
.
default_desc
):
def
gen_int64_field
(
name
=
ct
.
default_int64_field_name
,
is_primary
=
False
,
description
=
ct
.
default_desc
):
int64_field
=
FieldSchema
(
name
=
name
,
dtype
=
DataType
.
INT64
,
description
=
description
,
is_primary
=
is_primary
)
int64_field
=
FieldSchema
(
name
=
name
,
dtype
=
DataType
.
INT64
,
description
=
description
,
is_primary
=
is_primary
)
return
int64_field
return
int64_field
...
...
tests20/python_client/testcases/test_connection.py
浏览文件 @
bc3e0619
...
@@ -226,9 +226,9 @@ class TestConnectionOperation(TestcaseBase):
...
@@ -226,9 +226,9 @@ class TestConnectionOperation(TestcaseBase):
"""
"""
# error
# error
self
.
connection_wrap
.
add_connection
(
default
=
{
"host"
:
'host'
,
"port"
:
port
})
self
.
connection_wrap
.
add_connection
(
default
=
{
"host"
:
'host'
,
"port"
:
port
})
res
=
self
.
connection_wrap
.
connect
(
alias
=
"default"
,
host
=
host
,
port
=
port
,
check_
res
=
''
)
res
=
self
.
connection_wrap
.
connect
(
alias
=
"default"
,
host
=
host
,
port
=
port
,
check_
task
=
''
)
log
.
info
(
res
[
0
])
log
.
info
(
res
[
0
])
res
=
self
.
connection_wrap
.
connect
(
alias
=
"default"
,
host
=
host
,
port
=
port
,
check_
res
=
''
)
res
=
self
.
connection_wrap
.
connect
(
alias
=
"default"
,
host
=
host
,
port
=
port
,
check_
task
=
''
)
log
.
info
(
res
[
0
])
log
.
info
(
res
[
0
])
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
...
@@ -252,7 +252,7 @@ class TestConnectionOperation(TestcaseBase):
...
@@ -252,7 +252,7 @@ class TestConnectionOperation(TestcaseBase):
expected: assert res is wrong
expected: assert res is wrong
"""
"""
self
.
connection_wrap
.
get_connection
(
alias
=
'default'
,
check_res
=
CheckTasks
.
false
)
self
.
connection_wrap
.
get_connection
(
alias
=
'default'
,
check_res
=
CheckTasks
.
false
)
res
=
self
.
connection_wrap
.
connect
(
alias
=
"default"
,
host
=
'host'
,
port
=
port
,
check_
res
=
''
)
res
=
self
.
connection_wrap
.
connect
(
alias
=
"default"
,
host
=
'host'
,
port
=
port
,
check_
task
=
''
)
assert
res
[
0
].
args
[
0
]
==
"Fail connecting to server on host:19530. Timeout"
assert
res
[
0
].
args
[
0
]
==
"Fail connecting to server on host:19530. Timeout"
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
...
...
tests20/python_client/testcases/test_partition.py
浏览文件 @
bc3e0619
...
@@ -37,6 +37,7 @@ class TestPartitionParams(TestcaseBase):
...
@@ -37,6 +37,7 @@ class TestPartitionParams(TestcaseBase):
assert
collection_w
.
has_partition
(
partition_name
)[
0
]
assert
collection_w
.
has_partition
(
partition_name
)[
0
]
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
xfail
(
reason
=
"issue #5375"
)
@
pytest
.
mark
.
parametrize
(
"partition_name"
,
[
""
])
@
pytest
.
mark
.
parametrize
(
"partition_name"
,
[
""
])
def
test_partition_empty_name
(
self
,
partition_name
):
def
test_partition_empty_name
(
self
,
partition_name
):
"""
"""
...
@@ -50,7 +51,7 @@ class TestPartitionParams(TestcaseBase):
...
@@ -50,7 +51,7 @@ class TestPartitionParams(TestcaseBase):
# create partition
# create partition
self
.
partition_wrap
.
init_partition
(
collection_w
.
collection
,
partition_name
,
self
.
partition_wrap
.
init_partition
(
collection_w
.
collection
,
partition_name
,
check_task
=
CheckTasks
.
err_res
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"Partition
tag
should not be empty"
})
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"Partition
name
should not be empty"
})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
parametrize
(
"partition_name, description"
,
[(
cf
.
gen_unique_str
(
prefix
),
""
)])
@
pytest
.
mark
.
parametrize
(
"partition_name, description"
,
[(
cf
.
gen_unique_str
(
prefix
),
""
)])
...
@@ -74,6 +75,27 @@ class TestPartitionParams(TestcaseBase):
...
@@ -74,6 +75,27 @@ class TestPartitionParams(TestcaseBase):
# check that the partition has been created
# check that the partition has been created
assert
collection_w
.
has_partition
(
partition_name
)[
0
]
assert
collection_w
.
has_partition
(
partition_name
)[
0
]
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
parametrize
(
"partition_name, description"
,
[(
cf
.
gen_str_by_length
(
255
),
cf
.
gen_str_by_length
(
2048
))])
def
test_partition_max_description_length
(
self
,
partition_name
,
description
):
"""
target: verify create a partition with 255 length name and 1024 length description
method: 1. create a partition with 255 length name and 1024 length description
expected: 1. create successfully
"""
# create collection
collection_w
=
self
.
init_collection_wrap
()
# init partition
self
.
init_partition_wrap
(
collection_w
,
partition_name
,
description
=
description
,
check_task
=
CheckTasks
.
check_partition_property
,
check_items
=
{
"name"
:
partition_name
,
"description"
:
description
,
"is_empty"
:
True
}
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
parametrize
(
"collection_name, partition_name, description"
,
@
pytest
.
mark
.
parametrize
(
"collection_name, partition_name, description"
,
[(
cf
.
gen_unique_str
(),
cf
.
gen_unique_str
(
prefix
),
cf
.
gen_unique_str
())])
[(
cf
.
gen_unique_str
(),
cf
.
gen_unique_str
(
prefix
),
cf
.
gen_unique_str
())])
...
@@ -116,10 +138,8 @@ class TestPartitionParams(TestcaseBase):
...
@@ -116,10 +138,8 @@ class TestPartitionParams(TestcaseBase):
"is_empty"
:
True
,
"num_entities"
:
0
}
"is_empty"
:
True
,
"num_entities"
:
0
}
)
)
assert
collection_w
.
has_partition
(
partition_name
)[
0
]
assert
collection_w
.
has_partition
(
partition_name
)[
0
]
assert
collection_w
.
description
==
description
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
# @pytest.mark.xfail(reason="issue #5373")
def
test_partition_default_name
(
self
):
def
test_partition_default_name
(
self
):
"""
"""
target: verify create a partition with default name
target: verify create a partition with default name
...
@@ -140,6 +160,23 @@ class TestPartitionParams(TestcaseBase):
...
@@ -140,6 +160,23 @@ class TestPartitionParams(TestcaseBase):
partition_w
=
self
.
init_partition_wrap
(
collection_w
,
ct
.
default_partition_name
)
partition_w
=
self
.
init_partition_wrap
(
collection_w
,
ct
.
default_partition_name
)
assert
collection
.
name
==
partition_w
.
name
assert
collection
.
name
==
partition_w
.
name
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
parametrize
(
"partition_name"
,
[
cf
.
gen_str_by_length
(
256
)])
def
test_partition_maxlength_name
(
self
,
partition_name
):
"""
target: verify create a partition with maxlength(256) name
method: 1. create a partition with max length names
expected: 1. raise exception
"""
# create collection
collection_w
=
self
.
init_collection_wrap
()
# create partition
self
.
partition_wrap
.
init_partition
(
collection_w
.
collection
,
partition_name
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
{
"err_code"
:
1
,
'err_msg'
:
"is illegal"
}
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
parametrize
(
"partition_name"
,
ct
.
get_invalid_strs
)
@
pytest
.
mark
.
parametrize
(
"partition_name"
,
ct
.
get_invalid_strs
)
def
test_partition_invalid_name
(
self
,
partition_name
):
def
test_partition_invalid_name
(
self
,
partition_name
):
...
@@ -149,10 +186,10 @@ class TestPartitionParams(TestcaseBase):
...
@@ -149,10 +186,10 @@ class TestPartitionParams(TestcaseBase):
expected: 1. raise exception
expected: 1. raise exception
"""
"""
# create collection
# create collection
self
.
init_collection_wrap
()
collection_w
=
self
.
init_collection_wrap
()
# create partition
# create partition
self
.
partition_wrap
.
init_partition
(
self
.
collection_wrap
.
collection
,
partition_name
,
self
.
partition_wrap
.
init_partition
(
collection_w
.
collection
,
partition_name
,
check_task
=
CheckTasks
.
err_res
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
{
"err_code"
:
1
,
'err_msg'
:
"is illegal"
}
check_items
=
{
"err_code"
:
1
,
'err_msg'
:
"is illegal"
}
)
)
...
@@ -359,24 +396,23 @@ class TestPartitionOperations(TestcaseBase):
...
@@ -359,24 +396,23 @@ class TestPartitionOperations(TestcaseBase):
for
_
in
range
(
ct
.
max_partition_num
//
threads_n
):
for
_
in
range
(
ct
.
max_partition_num
//
threads_n
):
name
=
cf
.
gen_unique_str
(
prefix
)
name
=
cf
.
gen_unique_str
(
prefix
)
par_wrap
=
ApiPartitionWrapper
()
par_wrap
=
ApiPartitionWrapper
()
par_wrap
.
init_partition
(
collection
,
name
)
par_wrap
.
init_partition
(
collection
,
name
,
check_task
=
"check_nothing"
)
m_collection
=
self
.
init_collection_wrap
()
collection_w
=
self
.
init_collection_wrap
()
for
_
in
range
(
threads_num
):
for
_
in
range
(
threads_num
):
t
=
threading
.
Thread
(
target
=
create_partition
,
args
=
(
m_
collection
,
threads_num
))
t
=
threading
.
Thread
(
target
=
create_partition
,
args
=
(
collection_w
.
collection
,
threads_num
))
threads
.
append
(
t
)
threads
.
append
(
t
)
t
.
start
()
t
.
start
()
for
t
in
threads
:
for
t
in
threads
:
t
.
join
()
t
.
join
()
p_name
=
cf
.
gen_unique_str
()
p_name
=
cf
.
gen_unique_str
()
self
.
partition_wrap
.
init_partition
(
self
.
partition_wrap
.
init_partition
(
m_
collection
,
p_name
,
collection_w
.
collection
,
p_name
,
check_task
=
CheckTasks
.
err_res
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
{
"err_code"
:
1
,
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"maximum partition's number should be limit to 4096"
})
"err_msg"
:
"maximum partition's number should be limit to 4096"
})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
xfail
(
reason
=
"issue #5302"
)
@
pytest
.
mark
.
parametrize
(
"partition_name"
,
[
ct
.
default_partition_name
])
@
pytest
.
mark
.
parametrize
(
"partition_name"
,
[
ct
.
default_partition_name
])
def
test_partition_drop_default_partition
(
self
,
partition_name
):
def
test_partition_drop_default_partition
(
self
,
partition_name
):
"""
"""
...
@@ -387,12 +423,14 @@ class TestPartitionOperations(TestcaseBase):
...
@@ -387,12 +423,14 @@ class TestPartitionOperations(TestcaseBase):
# create collection
# create collection
collection_w
=
self
.
init_collection_wrap
()
collection_w
=
self
.
init_collection_wrap
()
# init partition
# get the default partition
partition_w
=
collection_w
.
partition
(
ct
.
default_partition_name
)
default_partition
,
_
=
collection_w
.
partition
(
ct
.
default_partition_name
)
partition_w
=
self
.
init_partition_wrap
(
collection_w
,
ct
.
default_partition_name
)
assert
default_partition
.
name
==
partition_w
.
name
# verify that drop partition with error
# verify that drop partition with error
partition_w
.
drop
(
check_task
=
CheckTasks
.
err_res
,
partition_w
.
drop
(
check_task
=
CheckTasks
.
err_res
,
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"
not
"
})
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"
default partition cannot be deleted
"
})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
parametrize
(
"partition_name"
,
[
cf
.
gen_unique_str
(
prefix
)])
@
pytest
.
mark
.
parametrize
(
"partition_name"
,
[
cf
.
gen_unique_str
(
prefix
)])
...
@@ -413,7 +451,7 @@ class TestPartitionOperations(TestcaseBase):
...
@@ -413,7 +451,7 @@ class TestPartitionOperations(TestcaseBase):
# drop partition
# drop partition
partition_w
.
drop
()
partition_w
.
drop
()
assert
not
collection_w
.
has_partition
(
partition_name
)
assert
not
collection_w
.
has_partition
(
partition_name
)
[
0
]
# verify that drop the partition again with exception
# verify that drop the partition again with exception
partition_w
.
drop
(
check_task
=
CheckTasks
.
err_res
,
partition_w
.
drop
(
check_task
=
CheckTasks
.
err_res
,
...
@@ -488,14 +526,14 @@ class TestPartitionOperations(TestcaseBase):
...
@@ -488,14 +526,14 @@ class TestPartitionOperations(TestcaseBase):
expected: drop successfully
expected: drop successfully
"""
"""
# create collection
# create collection
collection_w
=
self
.
_collection
()
collection_w
=
self
.
init_collection_wrap
()
# create partition
# create partition
partition_w
=
self
.
init_partition_wrap
(
collection_w
,
partition_name
)
partition_w
=
self
.
init_partition_wrap
(
collection_w
,
partition_name
)
assert
collection_w
.
has_partition
(
partition_name
)
assert
collection_w
.
has_partition
(
partition_name
)
[
0
]
# insert data to partition
# insert data to partition
self
.
partition_wrap
.
insert
(
data
)
partition_w
.
insert
(
data
)
# create index of collection
# create index of collection
collection_w
.
create_index
(
ct
.
default_float_vec_field_name
,
index_param
)
collection_w
.
create_index
(
ct
.
default_float_vec_field_name
,
index_param
)
...
@@ -631,6 +669,7 @@ class TestPartitionOperations(TestcaseBase):
...
@@ -631,6 +669,7 @@ class TestPartitionOperations(TestcaseBase):
# insert data to partition
# insert data to partition
partition_w
.
insert
(
data
)
partition_w
.
insert
(
data
)
# TODO: need a flush here
assert
partition_w
.
num_entities
==
len
(
data
)
assert
partition_w
.
num_entities
==
len
(
data
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
...
@@ -696,10 +735,8 @@ class TestPartitionOperations(TestcaseBase):
...
@@ -696,10 +735,8 @@ class TestPartitionOperations(TestcaseBase):
assert
partition_w
.
num_entities
==
max_size
assert
partition_w
.
num_entities
==
max_size
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
parametrize
(
"dim, expected_err"
,
@
pytest
.
mark
.
parametrize
(
"dim"
,
[
ct
.
default_dim
-
1
,
ct
.
default_dim
+
1
])
[(
ct
.
default_dim
-
1
,
"error"
),
(
ct
.
default_dim
+
1
,
"error"
)])
def
test_partition_insert_mismatched_dimensions
(
self
,
dim
):
@
pytest
.
mark
.
parametrize
(
"partition_name"
,
[
cf
.
gen_unique_str
(
prefix
)])
def
test_partition_insert_mismatched_dimensions
(
self
,
dim
,
expected_err
,
partition_name
):
"""
"""
target: verify insert maximum size data(256M?) a time
target: verify insert maximum size data(256M?) a time
method: 1.create a collection with default dim
method: 1.create a collection with default dim
...
@@ -707,12 +744,12 @@ class TestPartitionOperations(TestcaseBase):
...
@@ -707,12 +744,12 @@ class TestPartitionOperations(TestcaseBase):
expected: raise exception
expected: raise exception
"""
"""
# create partition
# create partition
partition_w
=
self
.
init_partition_wrap
(
partition_name
)
partition_w
=
self
.
init_partition_wrap
()
data
=
cf
.
gen_default_list_data
(
nb
=
10
,
dim
=
dim
)
data
=
cf
.
gen_default_list_data
(
nb
=
10
,
dim
=
dim
)
# insert data to partition
# insert data to partition
partition_w
.
insert
(
data
,
check_task
=
CheckTasks
.
err_res
,
partition_w
.
insert
(
data
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"
blabla
"
})
check_items
=
{
"err_code"
:
1
,
"err_msg"
:
"
Field type doesn't match
"
})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
parametrize
(
"sync"
,
[
True
,
False
])
@
pytest
.
mark
.
parametrize
(
"sync"
,
[
True
,
False
])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录