2020-11-26 16:01:31 +08:00
|
|
|
package querynode
|
2020-11-17 20:00:23 +08:00
|
|
|
|
|
|
|
import (
|
2020-12-08 14:41:04 +08:00
|
|
|
"fmt"
|
2020-11-21 15:06:46 +08:00
|
|
|
"strings"
|
2020-11-17 20:00:23 +08:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
2020-11-18 17:32:52 +08:00
|
|
|
func TestParamTable_PulsarAddress(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
address := Params.PulsarAddress
|
2020-11-21 15:06:46 +08:00
|
|
|
split := strings.Split(address, ":")
|
2020-12-08 14:41:04 +08:00
|
|
|
assert.Equal(t, "pulsar", split[0])
|
|
|
|
assert.Equal(t, "6650", split[len(split)-1])
|
2020-11-18 17:32:52 +08:00
|
|
|
}
|
|
|
|
|
2020-11-17 20:00:23 +08:00
|
|
|
func TestParamTable_QueryNodeID(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
id := Params.QueryNodeID
|
2020-12-08 14:41:04 +08:00
|
|
|
assert.Contains(t, Params.QueryNodeIDList(), id)
|
2020-11-17 20:00:23 +08:00
|
|
|
}
|
|
|
|
|
2020-11-26 16:01:31 +08:00
|
|
|
func TestParamTable_insertChannelRange(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
channelRange := Params.InsertChannelRange
|
2020-12-08 14:41:04 +08:00
|
|
|
assert.Equal(t, 2, len(channelRange))
|
2020-11-17 20:00:23 +08:00
|
|
|
}
|
2020-11-18 17:32:52 +08:00
|
|
|
|
|
|
|
func TestParamTable_statsServiceTimeInterval(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
interval := Params.StatsPublishInterval
|
2020-12-08 14:41:04 +08:00
|
|
|
assert.Equal(t, 1000, interval)
|
2020-11-18 17:32:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestParamTable_statsMsgStreamReceiveBufSize(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
bufSize := Params.StatsReceiveBufSize
|
2020-12-08 14:41:04 +08:00
|
|
|
assert.Equal(t, int64(64), bufSize)
|
2020-11-18 17:32:52 +08:00
|
|
|
}
|
|
|
|
|
2020-11-26 16:01:31 +08:00
|
|
|
func TestParamTable_insertMsgStreamReceiveBufSize(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
bufSize := Params.InsertReceiveBufSize
|
2020-12-08 14:41:04 +08:00
|
|
|
assert.Equal(t, int64(1024), bufSize)
|
2020-11-18 17:32:52 +08:00
|
|
|
}
|
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func TestParamTable_ddMsgStreamReceiveBufSize(t *testing.T) {
|
|
|
|
bufSize := Params.DDReceiveBufSize
|
|
|
|
assert.Equal(t, bufSize, int64(64))
|
|
|
|
}
|
|
|
|
|
2020-11-18 17:32:52 +08:00
|
|
|
func TestParamTable_searchMsgStreamReceiveBufSize(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
bufSize := Params.SearchReceiveBufSize
|
2020-12-08 14:41:04 +08:00
|
|
|
assert.Equal(t, int64(512), bufSize)
|
2020-11-18 17:32:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestParamTable_searchResultMsgStreamReceiveBufSize(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
bufSize := Params.SearchResultReceiveBufSize
|
2020-12-08 14:41:04 +08:00
|
|
|
assert.Equal(t, int64(64), bufSize)
|
2020-11-18 17:32:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestParamTable_searchPulsarBufSize(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
bufSize := Params.SearchPulsarBufSize
|
2020-12-08 14:41:04 +08:00
|
|
|
assert.Equal(t, int64(512), bufSize)
|
2020-11-18 17:32:52 +08:00
|
|
|
}
|
|
|
|
|
2020-11-26 16:01:31 +08:00
|
|
|
func TestParamTable_insertPulsarBufSize(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
bufSize := Params.InsertPulsarBufSize
|
2020-12-08 14:41:04 +08:00
|
|
|
assert.Equal(t, int64(1024), bufSize)
|
2020-11-18 17:32:52 +08:00
|
|
|
}
|
2020-11-19 10:46:17 +08:00
|
|
|
|
2020-12-10 16:31:09 +08:00
|
|
|
func TestParamTable_ddPulsarBufSize(t *testing.T) {
|
|
|
|
bufSize := Params.DDPulsarBufSize
|
|
|
|
assert.Equal(t, bufSize, int64(64))
|
|
|
|
}
|
|
|
|
|
2020-11-19 10:46:17 +08:00
|
|
|
func TestParamTable_flowGraphMaxQueueLength(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
length := Params.FlowGraphMaxQueueLength
|
2020-12-08 14:41:04 +08:00
|
|
|
assert.Equal(t, int32(1024), length)
|
2020-11-19 10:46:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestParamTable_flowGraphMaxParallelism(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
maxParallelism := Params.FlowGraphMaxParallelism
|
2020-12-08 14:41:04 +08:00
|
|
|
assert.Equal(t, int32(1024), maxParallelism)
|
2020-11-19 10:46:17 +08:00
|
|
|
}
|
2020-11-26 16:01:31 +08:00
|
|
|
|
|
|
|
func TestParamTable_insertChannelNames(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
names := Params.InsertChannelNames
|
|
|
|
channelRange := Params.InsertChannelRange
|
2020-12-08 14:41:04 +08:00
|
|
|
num := channelRange[1] - channelRange[0]
|
2020-12-10 16:31:09 +08:00
|
|
|
num = num / Params.QueryNodeNum
|
2020-12-08 14:41:04 +08:00
|
|
|
assert.Equal(t, num, len(names))
|
2020-12-10 16:31:09 +08:00
|
|
|
start := num * Params.SliceIndex
|
|
|
|
contains := strings.Contains(names[0], fmt.Sprintf("insert-%d", channelRange[start]))
|
|
|
|
assert.Equal(t, contains, true)
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestParamTable_searchChannelNames(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
names := Params.SearchChannelNames
|
2020-11-26 16:01:31 +08:00
|
|
|
assert.Equal(t, len(names), 1)
|
2020-12-10 16:31:09 +08:00
|
|
|
contains := strings.Contains(names[0], "search-0")
|
|
|
|
assert.Equal(t, contains, true)
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestParamTable_searchResultChannelNames(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
names := Params.SearchResultChannelNames
|
2020-12-08 14:41:04 +08:00
|
|
|
assert.NotNil(t, names)
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestParamTable_msgChannelSubName(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
name := Params.MsgChannelSubName
|
|
|
|
expectName := fmt.Sprintf("queryNode-%d", Params.QueryNodeID)
|
2020-12-08 14:41:04 +08:00
|
|
|
assert.Equal(t, expectName, name)
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestParamTable_statsChannelName(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
name := Params.StatsChannelName
|
|
|
|
contains := strings.Contains(name, "query-node-stats")
|
|
|
|
assert.Equal(t, contains, true)
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
2020-11-28 19:06:48 +08:00
|
|
|
|
|
|
|
func TestParamTable_metaRootPath(t *testing.T) {
|
2020-12-10 16:31:09 +08:00
|
|
|
path := Params.MetaRootPath
|
2020-12-22 22:08:03 +08:00
|
|
|
fmt.Println(path)
|
2020-11-28 19:06:48 +08:00
|
|
|
}
|
2020-12-10 16:31:09 +08:00
|
|
|
|
|
|
|
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")
|
|
|
|
}
|