Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
ff80e2f3
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,发现更多精彩内容 >>
未验证
提交
ff80e2f3
编写于
10月 24, 2021
作者:
T
ThreadDao
提交者:
GitHub
10月 24, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add case to test merge delete ids (#10525)
Signed-off-by:
N
ThreadDao
<
yufen.zong@zilliz.com
>
上级
66c1f7f1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
96 addition
and
2 deletion
+96
-2
tests/python_client/base/client_base.py
tests/python_client/base/client_base.py
+2
-2
tests/python_client/testcases/test_delete_20.py
tests/python_client/testcases/test_delete_20.py
+94
-0
未找到文件。
tests/python_client/base/client_base.py
浏览文件 @
ff80e2f3
...
...
@@ -103,13 +103,13 @@ class TestcaseBase(Base):
port
=
param_info
.
param_port
)
return
res
def
init_collection_wrap
(
self
,
name
=
None
,
schema
=
None
,
check_task
=
None
,
check_items
=
None
,
**
kwargs
):
def
init_collection_wrap
(
self
,
name
=
None
,
schema
=
None
,
shards_num
=
2
,
check_task
=
None
,
check_items
=
None
,
**
kwargs
):
name
=
cf
.
gen_unique_str
(
'coll_'
)
if
name
is
None
else
name
schema
=
cf
.
gen_default_collection_schema
()
if
schema
is
None
else
schema
if
self
.
connection_wrap
.
get_connection
(
alias
=
DefaultConfig
.
DEFAULT_USING
)[
0
]
is
None
:
self
.
_connect
()
collection_w
=
ApiCollectionWrapper
()
collection_w
.
init_collection
(
name
=
name
,
schema
=
schema
,
check_task
=
check_task
,
check_items
=
check_items
,
**
kwargs
)
collection_w
.
init_collection
(
name
=
name
,
schema
=
schema
,
shards_num
=
shards_num
,
check_task
=
check_task
,
check_items
=
check_items
,
**
kwargs
)
self
.
collection_object_list
.
append
(
collection_w
)
return
collection_w
...
...
tests/python_client/testcases/test_delete_20.py
浏览文件 @
ff80e2f3
...
...
@@ -314,6 +314,40 @@ class TestDeleteOperation(TestcaseBase):
assert
collection_w
.
num_entities
==
tmp_nb
-
1
assert
collection_w
.
has_index
()
@
pytest
.
mark
.
xfail
(
reason
=
"Issue: #10459"
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_delete_query_ids_both_sealed_and_channel
(
self
):
"""
target: test query that delete ids from both channle and sealed
method: 1.create and insert
2.delete id 0 and flush
3.load and query id 0
4.insert new id and delete the id
5.query id 0 and new id
expected: Empty querybresult
"""
# init collection and insert data without flush
collection_w
=
self
.
init_collection_wrap
(
name
=
cf
.
gen_unique_str
(
prefix
))
df
=
cf
.
gen_default_dataframe_data
(
tmp_nb
)
collection_w
.
insert
(
df
)
# delete id 0 and flush
del_res
,
_
=
collection_w
.
delete
(
tmp_expr
)
assert
del_res
.
delete_count
==
1
assert
collection_w
.
num_entities
==
tmp_nb
# load and query id 0
collection_w
.
query
(
tmp_expr
,
check_task
=
CheckTasks
.
check_query_empty
)
# insert id tmp_nb and delete id 0 and tmp_nb
df_new
=
cf
.
gen_default_dataframe_data
(
nb
=
1
,
start
=
tmp_nb
)
collection_w
.
insert
(
df_new
)
collection_w
.
delete
(
expr
=
f
'
{
ct
.
default_int64_field_name
}
in
{
[
tmp_nb
]
}
'
)
# query with id 0 and tmp_nb
collection_w
.
query
(
expr
=
f
'
{
ct
.
default_int64_field_name
}
in
{
[
0
,
tmp_nb
]
}
'
,
check_task
=
CheckTasks
.
check_query_empty
)
@
pytest
.
mark
.
xfail
(
reason
=
"Waiting for debug"
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_delete_search
(
self
):
...
...
@@ -665,6 +699,66 @@ class TestDeleteOperation(TestcaseBase):
expr
=
f
'
{
ct
.
default_int64_field_name
}
in
{
ids
}
'
collection_w
.
query
(
expr
,
check_task
=
CheckTasks
.
check_query_empty
)
@
pytest
.
mark
.
skip
(
reason
=
"Issue: #10459"
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_delete_merge_same_id_channel_and_sealed
(
self
):
"""
target: test merge same delete ids from channel and sealed
method: 1.create, insert
2.delete id and flush (data and deleted become sealed)
3.load and query (verify delete successfully)
4.insert entity with deleted id
5.delete id
6.query with id
expected: Empty query result
"""
# init collection and insert data without flush
collection_w
=
self
.
init_collection_wrap
(
name
=
cf
.
gen_unique_str
(
prefix
),
shards_num
=
1
)
df
=
cf
.
gen_default_dataframe_data
(
tmp_nb
)
collection_w
.
insert
(
df
)
# delete id 0 and flush
del_res
,
_
=
collection_w
.
delete
(
tmp_expr
)
assert
del_res
.
delete_count
==
1
assert
collection_w
.
num_entities
==
tmp_nb
# load and query id 0
collection_w
.
query
(
tmp_expr
,
check_task
=
CheckTasks
.
check_query_empty
)
# re-insert id 0 and re-delete id 0
collection_w
.
insert
(
df
[:
1
])
collection_w
.
delete
(
tmp_expr
)
collection_w
.
query
(
tmp_expr
,
check_task
=
CheckTasks
.
check_query_empty
)
@
pytest
.
mark
.
skip
(
reason
=
"Issue: #10459"
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_delete_merge_ids_channel_and_sealed
(
self
):
"""
target: test merge deleted ids come from both channel and sealed
method: 1.create, insert ids [0, tmp_nb) with shard_num=1
2.delete id 0 and flush
3.load and query with id 0
4.delete id 1 (merge same segment deleted ids 0 and 1)
5.query with id 0 and 1
expected: Empty query result
"""
# init collection and insert data without flush
collection_w
=
self
.
init_collection_wrap
(
name
=
cf
.
gen_unique_str
(
prefix
),
shards_num
=
1
)
df
=
cf
.
gen_default_dataframe_data
(
tmp_nb
)
collection_w
.
insert
(
df
)
# delete id 0 and flush
del_res
,
_
=
collection_w
.
delete
(
tmp_expr
)
assert
del_res
.
delete_count
==
1
assert
collection_w
.
num_entities
==
tmp_nb
# load and query id 0
collection_w
.
query
(
tmp_expr
,
check_task
=
CheckTasks
.
check_query_empty
)
# delete id 1 and query id 0 and 1
collection_w
.
delete
(
expr
=
f
'
{
ct
.
default_int64_field_name
}
in
{
[
1
]
}
'
)
collection_w
.
query
(
expr
=
f
'
{
ct
.
default_int64_field_name
}
in
{
[
0
,
1
]
}
'
,
check_task
=
CheckTasks
.
check_query_empty
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
@
pytest
.
mark
.
xfail
(
reason
=
"TODO"
)
def
test_delete_multi_threading
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录