未验证 提交 d6f96ec9 编写于 作者: X Xiangyu Wang 提交者: GitHub

Add unit tests for mq_msgstream.go (#8812)

Signed-off-by: NXiangyu Wang <xiangyu.wang@zilliz.com>
上级 cf860007
......@@ -608,7 +608,7 @@ var (
Help: "Counter of flush segments",
}, []string{"type"})
// DataNodeWatchDmChannelCounter used to count the num of calls of WatchDmChannels
// DataNodeWatchDmChannelsCounter used to count the num of calls of WatchDmChannels
DataNodeWatchDmChannelsCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: milvusNamespace,
......
......@@ -298,6 +298,46 @@ func TestMqMsgStream_Consume(t *testing.T) {
}
}
func TestMqMsgStream_Chan(t *testing.T) {
f := &fixture{t: t}
parameters := f.setup()
defer f.teardown()
factory := &ProtoUDFactory{}
for i := range parameters {
func(client mqclient.Client) {
m, err := NewMqMsgStream(context.Background(), 100, 100, client, factory.NewUnmarshalDispatcher())
assert.Nil(t, err)
ch := m.Chan()
assert.NotNil(t, ch)
}(parameters[i].client)
}
}
func TestMqMsgStream_Seek(t *testing.T) {
f := &fixture{t: t}
parameters := f.setup()
defer f.teardown()
factory := &ProtoUDFactory{}
for i := range parameters {
func(client mqclient.Client) {
m, err := NewMqMsgStream(context.Background(), 100, 100, client, factory.NewUnmarshalDispatcher())
assert.Nil(t, err)
// seek in not subscribed channel
p := []*internalpb.MsgPosition{
{
ChannelName: "b",
},
}
err = m.Seek(p)
assert.NotNil(t, err)
}(parameters[i].client)
}
}
/* ========================== Pulsar & RocksMQ Tests ========================== */
func TestStream_PulsarMsgStream_Insert(t *testing.T) {
pulsarAddress, _ := Params.Load("_PulsarAddress")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册