Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
74ffd5e5
M
milvus
项目概览
milvus
/
milvus
11 个月 前同步成功
通知
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 搜索 >>
未验证
提交
74ffd5e5
编写于
2月 22, 2022
作者:
T
ThreadDao
提交者:
GitHub
2月 22, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[test] Add and update compaction cases (#15680)
Signed-off-by:
N
ThreadDao
<
yufen.zong@zilliz.com
>
上级
ce9662c1
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
206 addition
and
61 deletion
+206
-61
tests/python_client/base/collection_wrapper.py
tests/python_client/base/collection_wrapper.py
+1
-1
tests/python_client/check/func_check.py
tests/python_client/check/func_check.py
+61
-1
tests/python_client/common/common_type.py
tests/python_client/common/common_type.py
+3
-1
tests/python_client/testcases/test_compaction.py
tests/python_client/testcases/test_compaction.py
+141
-58
未找到文件。
tests/python_client/base/collection_wrapper.py
浏览文件 @
74ffd5e5
...
...
@@ -253,7 +253,7 @@ class ApiCollectionWrapper:
check_result
=
ResponseChecker
(
res
,
func_name
,
check_task
,
check_items
,
check
,
**
kwargs
).
run
()
return
res
,
check_result
def
get_compaction_plans
(
self
,
timeout
=
None
,
check_task
=
None
,
check_items
=
None
,
**
kwargs
):
def
get_compaction_plans
(
self
,
timeout
=
None
,
check_task
=
None
,
check_items
=
{}
,
**
kwargs
):
timeout
=
TIMEOUT
if
timeout
is
None
else
timeout
func_name
=
sys
.
_getframe
().
f_code
.
co_name
res
,
check
=
api_request
([
self
.
collection
.
get_compaction_plans
,
timeout
],
**
kwargs
)
...
...
tests/python_client/check/func_check.py
浏览文件 @
74ffd5e5
from
pymilvus.client.types
import
CompactionPlans
from
utils.util_log
import
test_log
as
log
from
common
import
common_type
as
ct
from
common
import
common_func
as
cf
...
...
@@ -64,6 +66,12 @@ class ResponseChecker:
# Calculate distance interface that response check
result
=
self
.
check_distance
(
self
.
response
,
self
.
func_name
,
self
.
check_items
)
elif
self
.
check_task
==
CheckTasks
.
check_delete_compact
:
result
=
self
.
check_delete_compact_plan
(
self
.
response
,
self
.
func_name
,
self
.
check_items
)
elif
self
.
check_task
==
CheckTasks
.
check_merge_compact
:
result
=
self
.
check_merge_compact_plan
(
self
.
response
,
self
.
func_name
,
self
.
check_items
)
# Add check_items here if something new need verify
return
result
...
...
@@ -112,7 +120,6 @@ class ResponseChecker:
# assert res_obj == class_obj
if
func_name
==
"has_connection"
:
value_content
=
params
.
get
(
ct
.
value_content
,
False
)
res_obj
=
res
if
res
is
not
None
else
False
assert
res_obj
==
value_content
...
...
@@ -288,3 +295,56 @@ class ResponseChecker:
metric
,
sqrt
)
return
True
@
staticmethod
def
check_delete_compact_plan
(
compaction_plans
,
func_name
,
check_items
):
"""
Verify that the delete type compaction plan
:param: compaction_plans: A compaction plan
:type: CompactionPlans
:param func_name: get_compaction_plans API name
:type func_name: str
:param check_items: which items you wish to check
plans_num represent the delete compact plans number
:type: dict
"""
to_check_func
=
'get_compaction_plans'
if
func_name
!=
to_check_func
:
log
.
warning
(
"The function name is {} rather than {}"
.
format
(
func_name
,
to_check_func
))
if
not
isinstance
(
compaction_plans
,
CompactionPlans
):
raise
Exception
(
"The compaction_plans result to check isn't CompactionPlans type object"
)
plans_num
=
check_items
.
get
(
"plans_num"
,
1
)
assert
len
(
compaction_plans
.
plans
)
==
plans_num
for
plan
in
compaction_plans
.
plans
:
assert
len
(
plan
.
sources
)
==
1
assert
plan
.
sources
[
0
]
!=
plan
.
target
@
staticmethod
def
check_merge_compact_plan
(
compaction_plans
,
func_name
,
check_items
):
"""
Verify that the merge type compaction plan
:param: compaction_plans: A compaction plan
:type: CompactionPlans
:param func_name: get_compaction_plans API name
:type func_name: str
:param check_items: which items you wish to check
segment_num represent how many segments are expected to be merged, default is 2
:type: dict
"""
to_check_func
=
'get_compaction_plans'
if
func_name
!=
to_check_func
:
log
.
warning
(
"The function name is {} rather than {}"
.
format
(
func_name
,
to_check_func
))
if
not
isinstance
(
compaction_plans
,
CompactionPlans
):
raise
Exception
(
"The compaction_plans result to check isn't CompactionPlans type object"
)
segment_num
=
check_items
.
get
(
"segment_num"
,
2
)
assert
len
(
compaction_plans
.
plans
)
==
1
assert
len
(
compaction_plans
.
plans
[
0
].
sources
)
==
segment_num
assert
compaction_plans
.
plans
[
0
].
target
not
in
compaction_plans
.
plans
[
0
].
sources
tests/python_client/common/common_type.py
浏览文件 @
74ffd5e5
...
...
@@ -47,7 +47,7 @@ gracefulTime = 1
default_nlist
=
128
compact_segment_num_threshold
=
10
compact_delta_ratio_reciprocal
=
5
# compact_delta_binlog_ratio is 0.2
compact_retention_duration
=
2
0
# compaction travel time retention range 20s
compact_retention_duration
=
4
0
# compaction travel time retention range 20s
max_compaction_interval
=
60
# the max time interval (s) from the last compaction
max_field_num
=
256
# Maximum number of fields in a collection
...
...
@@ -179,6 +179,8 @@ class CheckTasks:
check_query_results
=
"check_query_results"
check_query_empty
=
"check_query_empty"
# verify that query result is empty
check_distance
=
"check_distance"
check_delete_compact
=
"check_delete_compact"
check_merge_compact
=
"check_merge_compact"
class
CaseLabel
:
...
...
tests/python_client/testcases/test_compaction.py
浏览文件 @
74ffd5e5
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录