2021-04-19 13:47:10 +08:00
|
|
|
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
|
|
|
|
// with the License. You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
|
|
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
|
|
// or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
|
|
|
2021-01-16 10:12:14 +08:00
|
|
|
package querynode
|
2020-11-17 20:00:23 +08:00
|
|
|
|
|
|
|
import (
|
2020-12-08 14:41:04 +08:00
|
|
|
"fmt"
|
2021-09-28 22:24:03 +08:00
|
|
|
"os"
|
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
|
|
|
}
|
|
|
|
|
2021-09-28 22:24:03 +08:00
|
|
|
func TestParamTable_cacheSize(t *testing.T) {
|
|
|
|
cacheSize := Params.CacheSize
|
|
|
|
assert.Equal(t, int64(32), cacheSize)
|
|
|
|
err := os.Setenv("CACHE_SIZE", "2")
|
|
|
|
assert.NoError(t, err)
|
|
|
|
Params.initCacheSize()
|
|
|
|
assert.Equal(t, int64(2), Params.CacheSize)
|
|
|
|
err = os.Setenv("CACHE_SIZE", "32")
|
|
|
|
assert.NoError(t, err)
|
|
|
|
Params.initCacheSize()
|
|
|
|
assert.Equal(t, int64(32), Params.CacheSize)
|
|
|
|
}
|
|
|
|
|
2020-12-24 20:55:40 +08:00
|
|
|
func TestParamTable_minio(t *testing.T) {
|
|
|
|
t.Run("Test endPoint", func(t *testing.T) {
|
|
|
|
endPoint := Params.MinioEndPoint
|
|
|
|
equal := endPoint == "localhost:9000" || endPoint == "minio:9000"
|
|
|
|
assert.Equal(t, equal, true)
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test accessKeyID", func(t *testing.T) {
|
|
|
|
accessKeyID := Params.MinioAccessKeyID
|
|
|
|
assert.Equal(t, accessKeyID, "minioadmin")
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test secretAccessKey", func(t *testing.T) {
|
|
|
|
secretAccessKey := Params.MinioSecretAccessKey
|
|
|
|
assert.Equal(t, secretAccessKey, "minioadmin")
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("Test useSSL", func(t *testing.T) {
|
|
|
|
useSSL := Params.MinioUseSSLStr
|
|
|
|
assert.Equal(t, useSSL, false)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
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_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-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_msgChannelSubName(t *testing.T) {
|
2021-09-23 10:53:53 +08:00
|
|
|
Params.QueryNodeID = 3
|
2021-06-19 12:38:06 +08:00
|
|
|
Params.initMsgChannelSubName()
|
2020-12-10 16:31:09 +08:00
|
|
|
name := Params.MsgChannelSubName
|
2021-09-23 10:53:53 +08:00
|
|
|
assert.Equal(t, name, "by-dev-queryNode-3")
|
2020-11-26 16:01:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestParamTable_statsChannelName(t *testing.T) {
|
2021-09-23 10:53:53 +08:00
|
|
|
Params.Init()
|
2020-12-10 16:31:09 +08:00
|
|
|
name := Params.StatsChannelName
|
2021-09-23 10:53:53 +08:00
|
|
|
assert.Equal(t, name, "by-dev-query-node-stats")
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestParamTable_QueryTimeTickChannel(t *testing.T) {
|
|
|
|
Params.Init()
|
|
|
|
ch := Params.QueryTimeTickChannelName
|
|
|
|
assert.Equal(t, ch, "by-dev-queryTimeTick")
|
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
|
|
|
}
|