2020-12-09 20:07:27 +08:00
|
|
|
package writenode
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestParamTable_WriteNode(t *testing.T) {
|
|
|
|
|
|
|
|
Params.Init()
|
|
|
|
|
|
|
|
t.Run("Test PulsarAddress", func(t *testing.T) {
|
2020-12-11 17:20:14 +08:00
|
|
|
address := Params.PulsarAddress
|
2020-12-09 20:07:27 +08:00
|
|
|
split := strings.Split(address, ":")
|
|
|
|
assert.Equal(t, split[0], "pulsar")
|
|
|
|
assert.Equal(t, split[len(split)-1], "6650")
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test WriteNodeID", func(t *testing.T) {
|
2020-12-11 17:20:14 +08:00
|
|
|
id := Params.WriteNodeID
|
2020-12-09 20:07:27 +08:00
|
|
|
assert.Equal(t, id, UniqueID(3))
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test insertChannelRange", func(t *testing.T) {
|
2020-12-11 17:20:14 +08:00
|
|
|
channelRange := Params.InsertChannelRange
|
2020-12-09 20:07:27 +08:00
|
|
|
assert.Equal(t, len(channelRange), 2)
|
|
|
|
assert.Equal(t, channelRange[0], 0)
|
|
|
|
assert.Equal(t, channelRange[1], 2)
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test insertMsgStreamReceiveBufSize", func(t *testing.T) {
|
2020-12-11 17:20:14 +08:00
|
|
|
bufSize := Params.InsertReceiveBufSize
|
2020-12-09 20:07:27 +08:00
|
|
|
assert.Equal(t, bufSize, int64(1024))
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test insertPulsarBufSize", func(t *testing.T) {
|
2020-12-11 17:20:14 +08:00
|
|
|
bufSize := Params.InsertPulsarBufSize
|
2020-12-09 20:07:27 +08:00
|
|
|
assert.Equal(t, bufSize, int64(1024))
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test flowGraphMaxQueueLength", func(t *testing.T) {
|
2020-12-11 17:20:14 +08:00
|
|
|
length := Params.FlowGraphMaxQueueLength
|
2020-12-09 20:07:27 +08:00
|
|
|
assert.Equal(t, length, int32(1024))
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test flowGraphMaxParallelism", func(t *testing.T) {
|
2020-12-11 17:20:14 +08:00
|
|
|
maxParallelism := Params.FlowGraphMaxParallelism
|
2020-12-09 20:07:27 +08:00
|
|
|
assert.Equal(t, maxParallelism, int32(1024))
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test insertChannelNames", func(t *testing.T) {
|
2020-12-11 17:20:14 +08:00
|
|
|
names := Params.InsertChannelNames
|
2020-12-09 20:07:27 +08:00
|
|
|
assert.Equal(t, len(names), 2)
|
2020-12-11 17:20:14 +08:00
|
|
|
assert.Equal(t, names[0], "insert-0")
|
|
|
|
assert.Equal(t, names[1], "insert-1")
|
2020-12-09 20:07:27 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test msgChannelSubName", func(t *testing.T) {
|
2020-12-11 17:20:14 +08:00
|
|
|
name := Params.MsgChannelSubName
|
2020-12-09 20:07:27 +08:00
|
|
|
assert.Equal(t, name, "writeNode-3")
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test timeTickChannelName", func(t *testing.T) {
|
2020-12-11 17:20:14 +08:00
|
|
|
name := Params.WriteNodeTimeTickChannelName
|
2020-12-26 17:05:24 +08:00
|
|
|
assert.Equal(t, name, "writeNodeTimeTick-3")
|
2020-12-09 20:07:27 +08:00
|
|
|
})
|
2020-12-23 18:06:04 +08:00
|
|
|
|
|
|
|
t.Run("Test minioAccessKeyID", func(t *testing.T) {
|
|
|
|
id := Params.MinioAccessKeyID
|
|
|
|
assert.Equal(t, id, "minioadmin")
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test minioSecretAccessKey", func(t *testing.T) {
|
|
|
|
id := Params.MinioSecretAccessKey
|
|
|
|
assert.Equal(t, id, "minioadmin")
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test MinioUseSSL", func(t *testing.T) {
|
|
|
|
id := Params.MinioUseSSL
|
|
|
|
assert.Equal(t, id, false)
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test MinioBucketName", func(t *testing.T) {
|
|
|
|
name := Params.MinioBucketName
|
2020-12-26 16:28:55 +08:00
|
|
|
assert.Equal(t, name, "a-bucket")
|
2020-12-23 18:06:04 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test FlushInsertBufSize", func(t *testing.T) {
|
|
|
|
name := Params.FlushInsertBufSize
|
2020-12-29 21:15:00 +08:00
|
|
|
assert.Equal(t, name, 500)
|
2020-12-23 18:06:04 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test FlushDdBufSize", func(t *testing.T) {
|
|
|
|
name := Params.FlushDdBufSize
|
|
|
|
assert.Equal(t, name, 20)
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test InsertLogRootPath", func(t *testing.T) {
|
|
|
|
name := Params.InsertLogRootPath
|
|
|
|
assert.Equal(t, name, "by-dev/insert_log")
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test DdLogRootPath", func(t *testing.T) {
|
|
|
|
name := Params.DdLogRootPath
|
|
|
|
assert.Equal(t, name, "by-dev/data_definition_log")
|
|
|
|
})
|
2020-12-09 20:07:27 +08:00
|
|
|
}
|