mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-05 13:28:49 +08:00
fb0705df1b
Signed-off-by: Enwei Jiao <enwei.jiao@zilliz.com>
43 lines
818 B
Go
43 lines
818 B
Go
package indexnode
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/milvus-io/milvus/internal/types"
|
|
"github.com/milvus-io/milvus/pkg/util/paramtable"
|
|
)
|
|
|
|
type mockIndexNodeComponent struct {
|
|
*IndexNode
|
|
}
|
|
|
|
var _ types.IndexNodeComponent = &mockIndexNodeComponent{}
|
|
|
|
func NewMockIndexNodeComponent(ctx context.Context) (types.IndexNodeComponent, error) {
|
|
paramtable.Init()
|
|
factory := &mockFactory{
|
|
chunkMgr: &mockChunkmgr{},
|
|
}
|
|
|
|
node := NewIndexNode(ctx, factory)
|
|
|
|
startEmbedEtcd()
|
|
etcdCli := getEtcdClient()
|
|
node.SetEtcdClient(etcdCli)
|
|
node.storageFactory = &mockStorageFactory{}
|
|
if err := node.Init(); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
if err := node.Start(); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
if err := node.Register(); err != nil {
|
|
return nil, err
|
|
}
|
|
return &mockIndexNodeComponent{
|
|
IndexNode: node,
|
|
}, nil
|
|
}
|