mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-03 04:19:18 +08:00
044b06421a
issue: #6578 Signed-off-by: sunby <bingyi.sun@zilliz.com>
32 lines
951 B
Go
32 lines
951 B
Go
package datacoord
|
|
|
|
import (
|
|
"testing"
|
|
|
|
memkv "github.com/milvus-io/milvus/internal/kv/mem"
|
|
"github.com/stretchr/testify/assert"
|
|
"stathat.com/c/consistent"
|
|
)
|
|
|
|
func TestReload(t *testing.T) {
|
|
t.Run("test reload with data", func(t *testing.T) {
|
|
Params.Init()
|
|
kv := memkv.NewMemoryKV()
|
|
hash := consistent.New()
|
|
cm, err := NewChannelManager(kv, &dummyPosProvider{}, withFactory(NewConsistentHashChannelPolicyFactory(hash)))
|
|
assert.Nil(t, err)
|
|
assert.Nil(t, cm.AddNode(1))
|
|
assert.Nil(t, cm.AddNode(2))
|
|
assert.Nil(t, cm.Watch(&channel{"channel1", 1}))
|
|
assert.Nil(t, cm.Watch(&channel{"channel2", 1}))
|
|
|
|
hash2 := consistent.New()
|
|
cm2, err := NewChannelManager(kv, &dummyPosProvider{}, withFactory(NewConsistentHashChannelPolicyFactory(hash2)))
|
|
assert.Nil(t, err)
|
|
assert.Nil(t, cm2.Startup([]int64{1, 2}))
|
|
assert.Nil(t, cm2.AddNode(3))
|
|
assert.True(t, cm2.Match(3, "channel1"))
|
|
assert.True(t, cm2.Match(3, "channel2"))
|
|
})
|
|
}
|