mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-05 05:18:52 +08:00
7ee8623e1a
Signed-off-by: Xiangyu Wang <xiangyu.wang@zilliz.com>
44 lines
1.2 KiB
Go
44 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, "collection0", 0, 0)
|
|
node.statsService = newStatsService(node.queryNodeLoopCtx, node.replica, nil)
|
|
node.statsService.start()
|
|
node.Close()
|
|
}
|
|
|
|
//NOTE: start pulsar before test
|
|
func TestSegmentManagement_sendSegmentStatistic(t *testing.T) {
|
|
node := newQueryNodeMock()
|
|
initTestMeta(t, node, "collection0", 0, 0)
|
|
|
|
const receiveBufSize = 1024
|
|
// start pulsar
|
|
producerChannels := []string{Params.StatsChannelName}
|
|
|
|
pulsarURL := Params.PulsarAddress
|
|
|
|
statsStream := pulsarms.NewPulsarMsgStream(node.queryNodeLoopCtx, receiveBufSize)
|
|
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.Close()
|
|
}
|