Fix master branch unittest error (#7083)

Resolves: #7080

Signed-off-by: yangxuan <xuan.yang@zilliz.com>
pull/7087/head
XuanYang-cn 2021-08-13 14:00:14 +08:00 committed by GitHub
parent 6c5be83ea1
commit 86ca96a02e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 51 deletions

View File

@ -320,11 +320,11 @@ func (node *DataNode) Start() error {
}
connectEtcdFn := func() error {
etcdClient, err := clientv3.New(clientv3.Config{Endpoints: Params.EtcdEndpoints})
etcdKV, err := etcdkv.NewEtcdKV(Params.EtcdEndpoints, Params.MetaRootPath)
if err != nil {
return err
}
node.kvClient = etcdkv.NewEtcdKV(etcdClient, Params.MetaRootPath)
node.kvClient = etcdKV
return nil
}
err = retry.Do(node.ctx, connectEtcdFn, retry.Attempts(ConnectEtcdMaxRetryTime))

View File

@ -24,7 +24,6 @@ import (
"github.com/golang/protobuf/proto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.etcd.io/etcd/clientv3"
"go.uber.org/zap"
etcdkv "github.com/milvus-io/milvus/internal/kv/etcd"
@ -333,11 +332,9 @@ func TestWatchChannel(t *testing.T) {
defer cancel()
t.Run("test watch channel", func(t *testing.T) {
client, err := clientv3.New(clientv3.Config{Endpoints: Params.EtcdEndpoints})
assert.Nil(t, err)
if assert.NotNil(t, client) {
kv := etcdkv.NewEtcdKV(client, Params.MetaRootPath)
kv, err := etcdkv.NewEtcdKV(Params.EtcdEndpoints, Params.MetaRootPath)
require.NoError(t, err)
ch := fmt.Sprintf("datanode-etcd-test-channel_%d", rand.Int31())
path := fmt.Sprintf("channel/%d/%s", node.NodeID, ch)
c := make(chan struct{})
@ -386,6 +383,5 @@ func TestWatchChannel(t *testing.T) {
_, has = node.vchan2SyncService[ch]
node.chanMut.RUnlock()
assert.False(t, has)
}
})
}