Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
27beb033
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,发现更多精彩内容 >>
未验证
提交
27beb033
编写于
9月 14, 2021
作者:
B
bigsheeper
提交者:
GitHub
9月 14, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add task unittest for query node (#7820)
Signed-off-by:
N
bigsheeper
<
yihao.dai@zilliz.com
>
上级
bcf9b4e2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
74 addition
and
9 deletion
+74
-9
internal/querynode/index_loader_test.go
internal/querynode/index_loader_test.go
+1
-1
internal/querynode/mock_test.go
internal/querynode/mock_test.go
+2
-1
internal/querynode/task_test.go
internal/querynode/task_test.go
+71
-7
未找到文件。
internal/querynode/index_loader_test.go
浏览文件 @
27beb033
...
...
@@ -46,7 +46,7 @@ func TestIndexLoader_setIndexInfo(t *testing.T) {
assert
.
NoError
(
t
,
err
)
err
=
historical
.
loader
.
indexLoader
.
setIndexInfo
(
defaultCollectionID
,
segment
,
rowIDFieldID
)
assert
.
Error
(
t
,
err
)
assert
.
No
Error
(
t
,
err
)
})
}
...
...
internal/querynode/mock_test.go
浏览文件 @
27beb033
...
...
@@ -795,7 +795,7 @@ func genSimpleHistorical(ctx context.Context) (*historical, error) {
if
err
!=
nil
{
return
nil
,
err
}
h
:=
newHistorical
(
ctx
,
n
il
,
nil
,
fac
,
kv
)
h
:=
newHistorical
(
ctx
,
n
ewMockRootCoord
(),
newMockIndexCoord
()
,
fac
,
kv
)
r
,
err
:=
genSimpleReplica
()
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -809,6 +809,7 @@ func genSimpleHistorical(ctx context.Context) (*historical, error) {
return
nil
,
err
}
h
.
replica
=
r
h
.
loader
.
historicalReplica
=
r
col
,
err
:=
h
.
replica
.
getCollectionByID
(
defaultCollectionID
)
if
err
!=
nil
{
return
nil
,
err
...
...
internal/querynode/task_test.go
浏览文件 @
27beb033
...
...
@@ -27,7 +27,7 @@ func TestTask_watchDmChannelsTask(t *testing.T) {
defer
cancel
()
genWatchDMChannelsRequest
:=
func
()
*
querypb
.
WatchDmChannelsRequest
{
schema
,
_
:=
genSimpleSchema
()
_
,
schema
:=
genSimpleSchema
()
req
:=
&
querypb
.
WatchDmChannelsRequest
{
Base
:
genCommonMsgBase
(
commonpb
.
MsgType_WatchDmChannels
),
CollectionID
:
defaultCollectionID
,
...
...
@@ -98,6 +98,26 @@ func TestTask_watchDmChannelsTask(t *testing.T) {
assert
.
NoError
(
t
,
err
)
})
t
.
Run
(
"test execute loadPartition without init collection and partition"
,
func
(
t
*
testing
.
T
)
{
node
,
err
:=
genSimpleQueryNode
(
ctx
)
assert
.
NoError
(
t
,
err
)
task
:=
watchDmChannelsTask
{
req
:
genWatchDMChannelsRequest
(),
node
:
node
,
}
task
.
req
.
Infos
=
[]
*
datapb
.
VchannelInfo
{
{
CollectionID
:
defaultCollectionID
,
ChannelName
:
defaultVChannel
,
},
}
task
.
req
.
CollectionID
++
task
.
req
.
PartitionID
++
err
=
task
.
Execute
(
ctx
)
assert
.
NoError
(
t
,
err
)
})
//t.Run("test execute seek error", func(t *testing.T) {
//
// node, err := genSimpleQueryNode(ctx)
...
...
@@ -128,7 +148,7 @@ func TestTask_loadSegmentsTask(t *testing.T) {
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
genLoadSegmentsRequest
:=
func
()
*
querypb
.
LoadSegmentsRequest
{
genLoad
Empty
SegmentsRequest
:=
func
()
*
querypb
.
LoadSegmentsRequest
{
_
,
schema
:=
genSimpleSchema
()
req
:=
&
querypb
.
LoadSegmentsRequest
{
Base
:
genCommonMsgBase
(
commonpb
.
MsgType_LoadSegments
),
...
...
@@ -140,7 +160,7 @@ func TestTask_loadSegmentsTask(t *testing.T) {
t
.
Run
(
"test timestamp"
,
func
(
t
*
testing
.
T
)
{
task
:=
loadSegmentsTask
{
req
:
genLoadSegmentsRequest
(),
req
:
genLoad
Empty
SegmentsRequest
(),
}
timestamp
:=
Timestamp
(
1000
)
task
.
req
.
Base
.
Timestamp
=
timestamp
...
...
@@ -153,7 +173,7 @@ func TestTask_loadSegmentsTask(t *testing.T) {
t
.
Run
(
"test OnEnqueue"
,
func
(
t
*
testing
.
T
)
{
task
:=
loadSegmentsTask
{
req
:
genLoadSegmentsRequest
(),
req
:
genLoad
Empty
SegmentsRequest
(),
}
err
:=
task
.
OnEnqueue
()
assert
.
NoError
(
t
,
err
)
...
...
@@ -166,8 +186,39 @@ func TestTask_loadSegmentsTask(t *testing.T) {
node
,
err
:=
genSimpleQueryNode
(
ctx
)
assert
.
NoError
(
t
,
err
)
schema
,
_
:=
genSimpleSchema
()
fieldBinlog
,
err
:=
saveSimpleBinLog
(
ctx
)
assert
.
NoError
(
t
,
err
)
req
:=
&
querypb
.
LoadSegmentsRequest
{
Base
:
genCommonMsgBase
(
commonpb
.
MsgType_LoadSegments
),
Schema
:
schema
,
LoadCondition
:
querypb
.
TriggerCondition_grpcRequest
,
Infos
:
[]
*
querypb
.
SegmentLoadInfo
{
{
SegmentID
:
defaultSegmentID
,
PartitionID
:
defaultPartitionID
,
CollectionID
:
defaultCollectionID
,
BinlogPaths
:
fieldBinlog
,
},
},
}
task
:=
loadSegmentsTask
{
req
:
req
,
node
:
node
,
}
err
=
task
.
Execute
(
ctx
)
assert
.
NoError
(
t
,
err
)
})
t
.
Run
(
"test execute grpc error"
,
func
(
t
*
testing
.
T
)
{
node
,
err
:=
genSimpleQueryNode
(
ctx
)
assert
.
NoError
(
t
,
err
)
task
:=
loadSegmentsTask
{
req
:
genLoadSegmentsRequest
(),
req
:
genLoad
Empty
SegmentsRequest
(),
node
:
node
,
}
task
.
req
.
Infos
=
[]
*
querypb
.
SegmentLoadInfo
{
...
...
@@ -186,7 +237,7 @@ func TestTask_loadSegmentsTask(t *testing.T) {
assert
.
NoError
(
t
,
err
)
task
:=
loadSegmentsTask
{
req
:
genLoadSegmentsRequest
(),
req
:
genLoad
Empty
SegmentsRequest
(),
node
:
node
,
}
task
.
req
.
Infos
=
[]
*
querypb
.
SegmentLoadInfo
{
...
...
@@ -206,7 +257,7 @@ func TestTask_loadSegmentsTask(t *testing.T) {
assert
.
NoError
(
t
,
err
)
task
:=
loadSegmentsTask
{
req
:
genLoadSegmentsRequest
(),
req
:
genLoad
Empty
SegmentsRequest
(),
node
:
node
,
}
task
.
req
.
Infos
=
[]
*
querypb
.
SegmentLoadInfo
{
...
...
@@ -220,6 +271,19 @@ func TestTask_loadSegmentsTask(t *testing.T) {
err
=
task
.
Execute
(
ctx
)
assert
.
Error
(
t
,
err
)
})
t
.
Run
(
"test execute load hand-off"
,
func
(
t
*
testing
.
T
)
{
node
,
err
:=
genSimpleQueryNode
(
ctx
)
assert
.
NoError
(
t
,
err
)
task
:=
loadSegmentsTask
{
req
:
genLoadEmptySegmentsRequest
(),
node
:
node
,
}
task
.
req
.
LoadCondition
=
querypb
.
TriggerCondition_handoff
err
=
task
.
Execute
(
ctx
)
assert
.
Error
(
t
,
err
)
})
}
func
TestTask_releaseCollectionTask
(
t
*
testing
.
T
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录