milvus/internal/querynode/param_table_test.go

133 lines
3.6 KiB
Go
Raw Normal View History

package querynode
import (
"fmt"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestParamTable_PulsarAddress(t *testing.T) {
address := Params.PulsarAddress
split := strings.Split(address, ":")
assert.Equal(t, "pulsar", split[0])
assert.Equal(t, "6650", split[len(split)-1])
}
func TestParamTable_QueryNodeID(t *testing.T) {
id := Params.QueryNodeID
assert.Contains(t, Params.QueryNodeIDList(), id)
}
func TestParamTable_insertChannelRange(t *testing.T) {
channelRange := Params.InsertChannelRange
assert.Equal(t, 2, len(channelRange))
}
func TestParamTable_statsServiceTimeInterval(t *testing.T) {
interval := Params.StatsPublishInterval
assert.Equal(t, 1000, interval)
}
func TestParamTable_statsMsgStreamReceiveBufSize(t *testing.T) {
bufSize := Params.StatsReceiveBufSize
assert.Equal(t, int64(64), bufSize)
}
func TestParamTable_insertMsgStreamReceiveBufSize(t *testing.T) {
bufSize := Params.InsertReceiveBufSize
assert.Equal(t, int64(1024), bufSize)
}
func TestParamTable_ddMsgStreamReceiveBufSize(t *testing.T) {
bufSize := Params.DDReceiveBufSize
assert.Equal(t, bufSize, int64(64))
}
func TestParamTable_searchMsgStreamReceiveBufSize(t *testing.T) {
bufSize := Params.SearchReceiveBufSize
assert.Equal(t, int64(512), bufSize)
}
func TestParamTable_searchResultMsgStreamReceiveBufSize(t *testing.T) {
bufSize := Params.SearchResultReceiveBufSize
assert.Equal(t, int64(64), bufSize)
}
func TestParamTable_searchPulsarBufSize(t *testing.T) {
bufSize := Params.SearchPulsarBufSize
assert.Equal(t, int64(512), bufSize)
}
func TestParamTable_insertPulsarBufSize(t *testing.T) {
bufSize := Params.InsertPulsarBufSize
assert.Equal(t, int64(1024), bufSize)
}
func TestParamTable_ddPulsarBufSize(t *testing.T) {
bufSize := Params.DDPulsarBufSize
assert.Equal(t, bufSize, int64(64))
}
func TestParamTable_flowGraphMaxQueueLength(t *testing.T) {
length := Params.FlowGraphMaxQueueLength
assert.Equal(t, int32(1024), length)
}
func TestParamTable_flowGraphMaxParallelism(t *testing.T) {
maxParallelism := Params.FlowGraphMaxParallelism
assert.Equal(t, int32(1024), maxParallelism)
}
func TestParamTable_insertChannelNames(t *testing.T) {
names := Params.InsertChannelNames
channelRange := Params.InsertChannelRange
num := channelRange[1] - channelRange[0]
num = num / Params.QueryNodeNum
assert.Equal(t, num, len(names))
start := num * Params.SliceIndex
contains := strings.Contains(names[0], fmt.Sprintf("insert-%d", channelRange[start]))
assert.Equal(t, contains, true)
}
func TestParamTable_searchChannelNames(t *testing.T) {
names := Params.SearchChannelNames
assert.Equal(t, len(names), 1)
contains := strings.Contains(names[0], "search-0")
assert.Equal(t, contains, true)
}
func TestParamTable_searchResultChannelNames(t *testing.T) {
names := Params.SearchResultChannelNames
assert.NotNil(t, names)
}
func TestParamTable_msgChannelSubName(t *testing.T) {
name := Params.MsgChannelSubName
expectName := fmt.Sprintf("queryNode-%d", Params.QueryNodeID)
assert.Equal(t, expectName, name)
}
func TestParamTable_statsChannelName(t *testing.T) {
name := Params.StatsChannelName
contains := strings.Contains(name, "query-node-stats")
assert.Equal(t, contains, true)
}
func TestParamTable_metaRootPath(t *testing.T) {
path := Params.MetaRootPath
fmt.Println(path)
}
func TestParamTable_ddChannelName(t *testing.T) {
names := Params.DDChannelNames
contains := strings.Contains(names[0], "data-definition-0")
assert.Equal(t, contains, true)
}
func TestParamTable_defaultPartitionTag(t *testing.T) {
tag := Params.DefaultPartitionTag
assert.Equal(t, tag, "_default")
}