Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
38280698
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,发现更多精彩内容 >>
未验证
提交
38280698
编写于
4月 29, 2022
作者:
T
ThreadDao
提交者:
GitHub
4月 29, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[test] Update load multi replicas cases (#16727)
Signed-off-by:
N
ThreadDao
<
yufen.zong@zilliz.com
>
上级
9e09434a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
44 addition
and
20 deletion
+44
-20
tests/python_client/testcases/test_collection.py
tests/python_client/testcases/test_collection.py
+26
-11
tests/python_client/testcases/test_partition.py
tests/python_client/testcases/test_partition.py
+18
-9
未找到文件。
tests/python_client/testcases/test_collection.py
浏览文件 @
38280698
...
...
@@ -2225,8 +2225,7 @@ class TestLoadCollection(TestcaseBase):
error
=
{
ct
.
err_code
:
1
,
ct
.
err_msg
:
f
"no enough nodes to create replicas"
}
collection_w
.
load
(
replica_number
=
3
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
@
pytest
.
mark
.
xfail
(
reason
=
"https://github.com/milvus-io/milvus/issues/16562"
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L3
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_load_replica_change
(
self
):
"""
target: test load replica change
...
...
@@ -2246,16 +2245,17 @@ class TestLoadCollection(TestcaseBase):
collection_w
.
query
(
expr
=
f
"
{
ct
.
default_int64_field_name
}
in [0]"
)
# verify load different replicas thrown an exception
collection_w
.
load
(
replica_number
=
2
)
error
=
{
ct
.
err_code
:
5
,
ct
.
err_msg
:
f
"Should release first then reload with the new number of replicas"
}
collection_w
.
load
(
replica_number
=
2
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
one_replica
,
_
=
collection_w
.
get_replicas
()
assert
len
(
one_replica
.
groups
)
==
1
collection_w
.
release
()
collection_w
.
load
(
replica_number
=
2
)
two_replicas
,
_
=
collection_w
.
get_replicas
()
log
.
debug
(
two_replicas
)
assert
len
(
two_replicas
.
groups
)
==
2
collection_w
.
query
(
expr
=
f
"
{
ct
.
default_int64_field_name
}
in [0]"
)
collection_w
.
query
(
expr
=
f
"
{
ct
.
default_int64_field_name
}
in [0]"
,
check_task
=
CheckTasks
.
check_query_results
,
check_items
=
{
'exp_res'
:
[{
'int64'
:
0
}]})
# verify loaded segments included 2 replicas and twice num entities
seg_info
,
_
=
self
.
utility_wrap
.
get_query_segment_info
(
collection_w
.
name
)
...
...
@@ -2264,7 +2264,7 @@ class TestLoadCollection(TestcaseBase):
assert
reduce
(
lambda
x
,
y
:
x
^
y
,
seg_ids
)
==
0
assert
reduce
(
lambda
x
,
y
:
x
+
y
,
num_entities
)
==
ct
.
default_nb
*
2
@
pytest
.
mark
.
tags
(
CaseLabel
.
L
3
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L
2
)
def
test_load_replica_multi
(
self
):
"""
target: test load with multiple replicas
...
...
@@ -2277,7 +2277,7 @@ class TestLoadCollection(TestcaseBase):
# create, insert
collection_w
=
self
.
init_collection_wrap
(
cf
.
gen_unique_str
(
prefix
),
shards_num
=
1
)
tmp_nb
=
1000
replica_number
=
5
replica_number
=
2
for
i
in
range
(
replica_number
):
df
=
cf
.
gen_default_dataframe_data
(
nb
=
tmp_nb
,
start
=
i
*
tmp_nb
)
insert_res
,
_
=
collection_w
.
insert
(
df
)
...
...
@@ -2292,7 +2292,7 @@ class TestLoadCollection(TestcaseBase):
search_res
,
_
=
collection_w
.
search
(
vectors
,
default_search_field
,
default_search_params
,
default_limit
)
assert
len
(
search_res
[
0
])
==
ct
.
default_limit
@
pytest
.
mark
.
tags
(
CaseLabel
.
L
3
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L
2
)
def
test_load_replica_partitions
(
self
):
"""
target: test load replica with partitions
...
...
@@ -2363,7 +2363,6 @@ class TestLoadCollection(TestcaseBase):
assert
len
(
shard_leaders
)
==
2
# Verify 2 replicas segments loaded
# https://github.com/milvus-io/milvus/issues/16598
seg_info
,
_
=
self
.
utility_wrap
.
get_query_segment_info
(
collection_w
.
name
)
seg_ids
=
list
(
map
(
lambda
seg
:
seg
.
segmentID
,
seg_info
))
assert
reduce
(
lambda
x
,
y
:
x
^
y
,
seg_ids
)
==
0
...
...
@@ -2373,10 +2372,9 @@ class TestLoadCollection(TestcaseBase):
assert
len
(
res
[
0
])
==
ct
.
default_limit
# verify query sealed and growing data successfully
exp_res
=
[{
'int64'
:
0
},
{
'int64'
:
3000
}]
collection_w
.
query
(
expr
=
f
"
{
ct
.
default_int64_field_name
}
in [0,
{
ct
.
default_nb
}
]"
,
check_task
=
CheckTasks
.
check_query_results
,
check_items
=
{
'exp_res'
:
exp_res
})
check_items
=
{
'exp_res'
:
[{
'int64'
:
0
},
{
'int64'
:
3000
}]
})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L3
)
def
test_load_replica_multiple_shard_leader
(
self
):
...
...
@@ -2429,6 +2427,23 @@ class TestLoadCollection(TestcaseBase):
check_task
=
CheckTasks
.
check_query_results
,
check_items
=
{
'exp_res'
:
[{
'int64'
:
0
},
{
'int64'
:
3000
}]})
# https://github.com/milvus-io/milvus/issues/16726
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_get_collection_replicas_not_loaded
(
self
):
"""
target: test get replicas of not loaded collection
method: not loaded collection and get replicas
expected: raise an exception
"""
# create, insert
collection_w
=
self
.
init_collection_wrap
(
cf
.
gen_unique_str
(
prefix
))
df
=
cf
.
gen_default_dataframe_data
()
insert_res
,
_
=
collection_w
.
insert
(
df
)
assert
collection_w
.
num_entities
==
ct
.
default_nb
collection_w
.
get_replicas
(
check_task
=
CheckTasks
.
err_res
,
check_items
=
{
"err_code"
:
15
,
"err_msg"
:
"getCollectionInfoByID: can't find collectionID"
})
class
TestReleaseAdvanced
(
TestcaseBase
):
@
pytest
.
mark
.
tags
(
CaseLabel
.
L0
)
...
...
tests/python_client/testcases/test_partition.py
浏览文件 @
38280698
from
functools
import
reduce
from
os
import
name
import
threading
import
pytest
...
...
@@ -353,8 +354,7 @@ class TestPartitionParams(TestcaseBase):
error
=
{
ct
.
err_code
:
1
,
ct
.
err_msg
:
f
"no enough nodes to create replicas"
}
partition_w
.
load
(
replica_number
=
3
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
@
pytest
.
mark
.
xfail
(
reason
=
"https://github.com/milvus-io/milvus/issues/16641"
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L3
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_load_replica_change
(
self
):
"""
target: test load replica change
...
...
@@ -372,17 +372,27 @@ class TestPartitionParams(TestcaseBase):
assert
partition_w
.
num_entities
==
ct
.
default_nb
partition_w
.
load
(
replica_number
=
1
)
collection_w
.
query
(
expr
=
f
"
{
ct
.
default_int64_field_name
}
in [0]"
)
partition_w
.
load
(
replica_number
=
2
)
collection_w
.
query
(
expr
=
f
"
{
ct
.
default_int64_field_name
}
in [0]"
,
check_task
=
CheckTasks
.
check_query_results
,
check_items
=
{
'exp_res'
:
[{
'int64'
:
0
}]})
error
=
{
ct
.
err_code
:
5
,
ct
.
err_msg
:
f
"Should release first then reload with the new number of replicas"
}
partition_w
.
load
(
replica_number
=
2
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
partition_w
.
release
()
partition_w
.
load
(
replica_number
=
2
)
collection_w
.
query
(
expr
=
f
"
{
ct
.
default_int64_field_name
}
in [0]"
)
# replica_info = partition_w.get_replicas(
)
collection_w
.
query
(
expr
=
f
"
{
ct
.
default_int64_field_name
}
in [0]"
,
check_task
=
CheckTasks
.
check_query_results
,
check_items
=
{
'exp_res'
:
[{
'int64'
:
0
}]}
)
# verify replicas
two_replicas
,
_
=
collection_w
.
get_replicas
()
assert
len
(
two_replicas
.
groups
)
==
2
@
pytest
.
mark
.
tags
(
CaseLabel
.
L3
)
# verify loaded segments included 2 replicas and twice num entities
seg_info
,
_
=
self
.
utility_wrap
.
get_query_segment_info
(
collection_w
.
name
)
seg_ids
=
list
(
map
(
lambda
seg
:
seg
.
segmentID
,
seg_info
))
num_entities
=
list
(
map
(
lambda
seg
:
seg
.
num_rows
,
seg_info
))
assert
reduce
(
lambda
x
,
y
:
x
^
y
,
seg_ids
)
==
0
assert
reduce
(
lambda
x
,
y
:
x
+
y
,
num_entities
)
==
ct
.
default_nb
*
2
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_partition_replicas_change_cross_partitions
(
self
):
"""
target: test load with different replicas between partitions
...
...
@@ -390,7 +400,6 @@ class TestPartitionParams(TestcaseBase):
2.Load two partitions with different replicas
expected: Raise an exception
"""
from
functools
import
reduce
# Create two partitions and insert data
collection_w
=
self
.
init_collection_wrap
()
partition_w1
=
self
.
init_partition_wrap
(
collection_w
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录