Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
68695eb7
M
milvus
项目概览
milvus
/
milvus
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
未验证
提交
68695eb7
编写于
4月 11, 2022
作者:
B
binbin
提交者:
GitHub
4月 11, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix bug for test tag and load interface change (#16454)
Signed-off-by:
N
Binbin Lv
<
binbin.lv@zilliz.com
>
上级
66aeaba1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
52 addition
and
36 deletion
+52
-36
tests/python_client/common/common_func.py
tests/python_client/common/common_func.py
+16
-0
tests/python_client/testcases/test_collection.py
tests/python_client/testcases/test_collection.py
+3
-3
tests/python_client/testcases/test_query.py
tests/python_client/testcases/test_query.py
+2
-2
tests/python_client/testcases/test_search_20.py
tests/python_client/testcases/test_search_20.py
+2
-2
tests/python_client/testcases/test_utility.py
tests/python_client/testcases/test_utility.py
+29
-29
未找到文件。
tests/python_client/common/common_func.py
浏览文件 @
68695eb7
...
...
@@ -548,3 +548,19 @@ def get_segment_distribution(res):
segment_distribution
[
r
.
nodeID
][
"growing"
].
append
(
r
.
segmentID
)
return
segment_distribution
def
percent_to_int
(
string
):
"""
transform percent(0%--100%) to int
"""
new_int
=
-
1
if
not
isinstance
(
string
,
str
):
log
.
error
(
"%s is not a string"
%
string
)
return
new_int
if
"%"
not
in
string
:
log
.
error
(
"%s is not a percent"
%
string
)
else
:
new_int
=
int
(
string
.
strip
(
"%"
))
return
new_int
tests/python_client/testcases/test_collection.py
浏览文件 @
68695eb7
...
...
@@ -888,7 +888,7 @@ class TestCollectionParams(TestcaseBase):
check_items
=
{
exp_name
:
c_name
,
exp_schema
:
default_binary_schema
})
assert
c_name
in
self
.
utility_wrap
.
list_collections
()[
0
]
@
pytest
.
mark
.
tag
(
CaseLabel
.
L0
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L0
)
def
test_collection_shards_num_with_default_value
(
self
):
"""
target:test collection with shards_num
...
...
@@ -902,7 +902,7 @@ class TestCollectionParams(TestcaseBase):
check_items
=
{
exp_name
:
c_name
,
exp_shards_num
:
default_shards_num
})
assert
c_name
in
self
.
utility_wrap
.
list_collections
()[
0
]
@
pytest
.
mark
.
tag
(
CaseLabel
.
L0
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L0
)
@
pytest
.
mark
.
parametrize
(
"shards_num"
,
[
-
256
,
0
,
10
,
256
])
def
test_collection_shards_num_with_not_default_value
(
self
,
shards_num
):
"""
...
...
@@ -917,7 +917,7 @@ class TestCollectionParams(TestcaseBase):
check_items
=
{
exp_name
:
c_name
,
exp_shards_num
:
shards_num
})
assert
c_name
in
self
.
utility_wrap
.
list_collections
()[
0
]
@
pytest
.
mark
.
tag
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L2
)
def
test_collection_shards_num_with_error_type
(
self
):
"""
target:test collection with error type shards_num
...
...
tests/python_client/testcases/test_query.py
浏览文件 @
68695eb7
...
...
@@ -405,7 +405,7 @@ class TestQueryParams(TestcaseBase):
res
=
df
.
iloc
[:
pos
,
:
1
].
to_dict
(
'records'
)
self
.
collection_wrap
.
query
(
term_expr
,
check_task
=
CheckTasks
.
check_query_results
,
check_items
=
{
exp_res
:
res
})
@
pytest
.
mark
.
tag
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L1
)
def
test_query_expr_random_values
(
self
):
"""
target: test query with random filter values
...
...
@@ -426,7 +426,7 @@ class TestQueryParams(TestcaseBase):
res
=
df
.
iloc
[
random_values
,
:
1
].
to_dict
(
'records'
)
self
.
collection_wrap
.
query
(
term_expr
,
check_task
=
CheckTasks
.
check_query_results
,
check_items
=
{
exp_res
:
res
})
@
pytest
.
mark
.
tag
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L2
)
def
test_query_expr_not_in_random
(
self
):
"""
target: test query with fixed filter values
...
...
tests/python_client/testcases/test_search_20.py
浏览文件 @
68695eb7
...
...
@@ -882,7 +882,7 @@ class TestCollectionSearch(TestcaseBase):
"ids"
:
insert_ids
,
"limit"
:
default_limit
})
@
pytest
.
mark
.
tag
(
CaseLabel
.
L0
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L0
)
def
test_search_with_hit_vectors
(
self
,
nq
,
dim
,
auto_id
):
"""
target: test search with vectors in collections
...
...
@@ -1608,7 +1608,7 @@ class TestCollectionSearch(TestcaseBase):
res
=
res
.
result
()
assert
abs
(
res
[
0
].
distances
[
0
]
-
min
(
distance_0
,
distance_1
))
<=
epsilon
@
pytest
.
mark
.
tag
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L2
)
def
test_search_travel_time_without_expression
(
self
,
auto_id
):
"""
target: test search using travel time without expression
...
...
tests/python_client/testcases/test_utility.py
浏览文件 @
68695eb7
...
...
@@ -225,7 +225,7 @@ class TestUtilityParams(TestcaseBase):
error
=
{
ct
.
err_code
:
1
,
ct
.
err_msg
:
"describe collection failed: can't find collection"
}
self
.
utility_wrap
.
loading_progress
(
"not_existed_name"
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
@
pytest
.
mark
.
tag
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
xfail
(
reason
=
"pymilvus issue #677"
)
def
test_loading_progress_invalid_partition_names
(
self
,
get_invalid_partition_names
):
"""
...
...
@@ -240,7 +240,7 @@ class TestUtilityParams(TestcaseBase):
self
.
utility_wrap
.
loading_progress
(
collection_w
.
name
,
partition_names
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
err_msg
)
@
pytest
.
mark
.
tag
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
parametrize
(
"partition_names"
,
[[
ct
.
default_tag
],
[
ct
.
default_partition_name
,
ct
.
default_tag
]])
def
test_loading_progress_not_existed_partitions
(
self
,
partition_names
):
"""
...
...
@@ -759,7 +759,7 @@ class TestUtilityBase(TestcaseBase):
res
,
_
=
self
.
utility_wrap
.
index_building_progress
(
c_name
)
assert
res
[
"indexed_rows"
]
==
nb
@
pytest
.
mark
.
tag
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L2
)
def
test_loading_progress_without_loading
(
self
):
"""
target: test loading progress without loading
...
...
@@ -770,11 +770,11 @@ class TestUtilityBase(TestcaseBase):
df
=
cf
.
gen_default_dataframe_data
()
collection_w
.
insert
(
df
)
assert
collection_w
.
num_entities
==
ct
.
default_nb
exp_res
=
{
num_loaded_entities
:
0
,
num_total_entities
:
ct
.
default_nb
}
exp_res
=
{
loading_progress
:
'0%'
}
res
,
_
=
self
.
utility_wrap
.
loading_progress
(
collection_w
.
name
)
assert
res
==
exp_res
@
pytest
.
mark
.
tag
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
parametrize
(
"nb"
,
[
ct
.
default_nb
,
5000
])
def
test_loading_progress_collection
(
self
,
nb
):
"""
...
...
@@ -785,10 +785,9 @@ class TestUtilityBase(TestcaseBase):
# create, insert default_nb, flush and load
collection_w
=
self
.
init_collection_general
(
prefix
,
insert_data
=
True
,
nb
=
nb
)[
0
]
res
,
_
=
self
.
utility_wrap
.
loading_progress
(
collection_w
.
name
)
assert
res
[
num_total_entities
]
==
nb
assert
res
[
num_loaded_entities
]
==
nb
assert
res
[
loading_progress
]
==
'100%'
@
pytest
.
mark
.
tag
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L2
)
def
test_loading_progress_with_async_load
(
self
):
"""
target: test loading progress with async collection load
...
...
@@ -801,9 +800,13 @@ class TestUtilityBase(TestcaseBase):
assert
collection_w
.
num_entities
==
ct
.
default_nb
collection_w
.
load
(
_async
=
True
)
res
,
_
=
self
.
utility_wrap
.
loading_progress
(
collection_w
.
name
)
assert
(
0
<=
res
[
num_loaded_entities
]
<=
ct
.
default_nb
)
loading_int
=
cf
.
percent_to_int
(
res
[
loading_progress
])
if
-
1
!=
loading_int
:
assert
(
0
<=
loading_int
<=
100
)
else
:
log
.
info
(
"The output of loading progress is not a string or a percentage"
)
@
pytest
.
mark
.
tag
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L2
)
def
test_loading_progress_empty_collection
(
self
):
"""
target: test loading_progress on an empty collection
...
...
@@ -813,10 +816,10 @@ class TestUtilityBase(TestcaseBase):
collection_w
=
self
.
init_collection_wrap
()
collection_w
.
load
()
res
,
_
=
self
.
utility_wrap
.
loading_progress
(
collection_w
.
name
)
exp_res
=
{
num_loaded_entities
:
0
,
num_total_entities
:
0
}
exp_res
=
{
loading_progress
:
'100%'
}
assert
exp_res
==
res
@
pytest
.
mark
.
tag
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L1
)
def
test_loading_progress_after_release
(
self
):
"""
target: test loading progress without loading
...
...
@@ -825,16 +828,16 @@ class TestUtilityBase(TestcaseBase):
"""
collection_w
=
self
.
init_collection_general
(
prefix
,
insert_data
=
True
)[
0
]
collection_w
.
release
()
exp_res
=
{
num_loaded_entities
:
0
,
num_total_entities
:
ct
.
default_nb
}
exp_res
=
{
loading_progress
:
'0%'
}
res
,
_
=
self
.
utility_wrap
.
loading_progress
(
collection_w
.
name
)
assert
res
==
exp_res
@
pytest
.
mark
.
tag
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L2
)
def
test_loading_progress_with_release_partition
(
self
):
"""
target: test loading progress after release part partitions
method: 1.insert data into two partitions and flush
2.load one partiton and release one partition
2.load one partit
i
on and release one partition
expected: loaded one partition entities
"""
half
=
ct
.
default_nb
...
...
@@ -842,10 +845,9 @@ class TestUtilityBase(TestcaseBase):
collection_w
,
partition_w
,
_
,
_
=
self
.
insert_entities_into_two_partitions_in_half
(
half
)
partition_w
.
release
()
res
=
self
.
utility_wrap
.
loading_progress
(
collection_w
.
name
)[
0
]
assert
res
[
num_total_entities
]
==
half
*
2
assert
res
[
num_loaded_entities
]
==
half
assert
res
[
loading_progress
]
==
'50%'
@
pytest
.
mark
.
tag
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L2
)
def
test_loading_progress_with_load_partition
(
self
):
"""
target: test loading progress after load partition
...
...
@@ -858,10 +860,9 @@ class TestUtilityBase(TestcaseBase):
collection_w
.
release
()
partition_w
.
load
()
res
=
self
.
utility_wrap
.
loading_progress
(
collection_w
.
name
)[
0
]
assert
res
[
num_total_entities
]
==
half
*
2
assert
res
[
num_loaded_entities
]
==
half
assert
res
[
loading_progress
]
==
'50%'
@
pytest
.
mark
.
tag
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L1
)
def
test_loading_progress_with_partition
(
self
):
"""
target: test loading progress with partition
...
...
@@ -872,8 +873,7 @@ class TestUtilityBase(TestcaseBase):
half
=
ct
.
default_nb
collection_w
,
partition_w
,
_
,
_
=
self
.
insert_entities_into_two_partitions_in_half
(
half
)
res
=
self
.
utility_wrap
.
loading_progress
(
collection_w
.
name
,
partition_names
=
[
partition_w
.
name
])[
0
]
assert
res
[
num_total_entities
]
==
half
assert
res
[
num_loaded_entities
]
==
half
assert
res
[
loading_progress
]
==
'100%'
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
def
test_wait_loading_collection_empty
(
self
):
...
...
@@ -890,7 +890,7 @@ class TestUtilityBase(TestcaseBase):
exp_res
=
{
loading_progress
:
"100%"
}
assert
res
==
exp_res
@
pytest
.
mark
.
tag
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L1
)
def
test_wait_for_loading_complete
(
self
):
"""
target: test wait for loading collection
...
...
@@ -905,9 +905,9 @@ class TestUtilityBase(TestcaseBase):
collection_w
.
load
(
_async
=
True
)
self
.
utility_wrap
.
wait_for_loading_complete
(
collection_w
.
name
)
res
,
_
=
self
.
utility_wrap
.
loading_progress
(
collection_w
.
name
)
assert
res
[
num_loaded_entities
]
==
nb
assert
res
[
loading_progress
]
==
'100%'
@
pytest
.
mark
.
tag
(
CaseLabel
.
L0
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L0
)
def
test_drop_collection
(
self
):
"""
target: test utility drop collection by name
...
...
@@ -920,7 +920,7 @@ class TestUtilityBase(TestcaseBase):
self
.
utility_wrap
.
drop_collection
(
c_name
)
assert
not
self
.
utility_wrap
.
has_collection
(
c_name
)[
0
]
@
pytest
.
mark
.
tag
(
CaseLabel
.
L0
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L0
)
def
test_drop_collection_repeatedly
(
self
):
"""
target: test drop collection repeatedly
...
...
@@ -935,7 +935,7 @@ class TestUtilityBase(TestcaseBase):
error
=
{
ct
.
err_code
:
1
,
ct
.
err_msg
:
{
"describe collection failed: can't find collection:"
}}
self
.
utility_wrap
.
drop_collection
(
c_name
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
@
pytest
.
mark
.
tag
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L2
)
def
test_drop_collection_create_repeatedly
(
self
):
"""
target: test repeatedly create and drop same name collection
...
...
@@ -1323,7 +1323,7 @@ class TestUtilityAdvanced(TestcaseBase):
for
name
in
[
c_name
,
c_name_2
]:
assert
name
in
res
@
pytest
.
mark
.
tag
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
tag
s
(
CaseLabel
.
L2
)
def
test_drop_multi_collection_concurrent
(
self
):
"""
target: test concurrent drop collection
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录