mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 04:49:08 +08:00
fd9e42d3ed
Signed-off-by: Xiangyu Wang <xiangyu.wang@zilliz.com>
45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
package querynode
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/zilliztech/milvus-distributed/internal/msgstream"
|
|
"github.com/zilliztech/milvus-distributed/internal/msgstream/pulsarms"
|
|
)
|
|
|
|
// NOTE: start pulsar before test
|
|
func TestStatsService_start(t *testing.T) {
|
|
node := newQueryNodeMock()
|
|
initTestMeta(t, node, 0, 0)
|
|
node.statsService = newStatsService(node.queryNodeLoopCtx, node.replica, nil)
|
|
node.statsService.start()
|
|
node.Stop()
|
|
}
|
|
|
|
//NOTE: start pulsar before test
|
|
func TestSegmentManagement_sendSegmentStatistic(t *testing.T) {
|
|
node := newQueryNodeMock()
|
|
initTestMeta(t, node, 0, 0)
|
|
|
|
const receiveBufSize = 1024
|
|
// start pulsar
|
|
producerChannels := []string{Params.StatsChannelName}
|
|
|
|
pulsarURL := Params.PulsarAddress
|
|
|
|
factory := msgstream.ProtoUDFactory{}
|
|
statsStream := pulsarms.NewPulsarMsgStream(node.queryNodeLoopCtx, receiveBufSize, 1024, factory.NewUnmarshalDispatcher())
|
|
statsStream.SetPulsarClient(pulsarURL)
|
|
statsStream.CreatePulsarProducers(producerChannels)
|
|
|
|
var statsMsgStream msgstream.MsgStream = statsStream
|
|
|
|
node.statsService = newStatsService(node.queryNodeLoopCtx, node.replica, nil)
|
|
node.statsService.statsStream = statsMsgStream
|
|
node.statsService.statsStream.Start()
|
|
|
|
// send stats
|
|
node.statsService.publicStatistic(nil)
|
|
node.Stop()
|
|
}
|