param_table_test.go 3.0 KB
Newer Older
1 2 3
package master

import (
X
XuanYang-cn 已提交
4
	"fmt"
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestParamTable_Init(t *testing.T) {
	Params.Init()
}

func TestParamTable_Address(t *testing.T) {
	address := Params.Address
	assert.Equal(t, address, "localhost")
}

func TestParamTable_Port(t *testing.T) {
	port := Params.Port
	assert.Equal(t, port, 53100)
}

C
cai.zhang 已提交
24 25 26 27 28 29 30 31
func TestParamTable_MetaRootPath(t *testing.T) {
	path := Params.MetaRootPath
	assert.Equal(t, path, "by-dev/meta")
}

func TestParamTable_KVRootPath(t *testing.T) {
	path := Params.KvRootPath
	assert.Equal(t, path, "by-dev/kv")
32 33
}

S
sunby 已提交
34 35 36 37 38
func TestParamTable_IndexBuilderAddress(t *testing.T) {
	path := Params.IndexBuilderAddress
	assert.Equal(t, path, "localhost:31000")
}

39 40
func TestParamTable_TopicNum(t *testing.T) {
	num := Params.TopicNum
X
XuanYang-cn 已提交
41
	fmt.Println("TopicNum:", num)
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
}

func TestParamTable_SegmentSize(t *testing.T) {
	size := Params.SegmentSize
	assert.Equal(t, size, float64(512))
}

func TestParamTable_SegmentSizeFactor(t *testing.T) {
	factor := Params.SegmentSizeFactor
	assert.Equal(t, factor, 0.75)
}

func TestParamTable_DefaultRecordSize(t *testing.T) {
	size := Params.DefaultRecordSize
	assert.Equal(t, size, int64(1024))
}

func TestParamTable_MinSegIDAssignCnt(t *testing.T) {
	cnt := Params.MinSegIDAssignCnt
	assert.Equal(t, cnt, int64(1024))
}

func TestParamTable_MaxSegIDAssignCnt(t *testing.T) {
	cnt := Params.MaxSegIDAssignCnt
	assert.Equal(t, cnt, int64(16384))
}

func TestParamTable_SegIDAssignExpiration(t *testing.T) {
	expiration := Params.SegIDAssignExpiration
	assert.Equal(t, expiration, int64(2000))
}

func TestParamTable_QueryNodeNum(t *testing.T) {
	num := Params.QueryNodeNum
X
XuanYang-cn 已提交
76
	fmt.Println("QueryNodeNum", num)
77 78 79 80 81 82 83 84 85
}

func TestParamTable_QueryNodeStatsChannelName(t *testing.T) {
	name := Params.QueryNodeStatsChannelName
	assert.Equal(t, name, "query-node-stats")
}

func TestParamTable_ProxyIDList(t *testing.T) {
	ids := Params.ProxyIDList
N
neza2017 已提交
86
	assert.Equal(t, len(ids), 1)
D
dragondriver 已提交
87
	assert.Equal(t, ids[0], int64(0))
88 89 90 91
}

func TestParamTable_ProxyTimeTickChannelNames(t *testing.T) {
	names := Params.ProxyTimeTickChannelNames
N
neza2017 已提交
92
	assert.Equal(t, len(names), 1)
D
dragondriver 已提交
93
	assert.Equal(t, names[0], "proxyTimeTick-0")
94 95 96 97 98 99 100 101 102 103 104 105 106 107
}

func TestParamTable_MsgChannelSubName(t *testing.T) {
	name := Params.MsgChannelSubName
	assert.Equal(t, name, "master")
}

func TestParamTable_SoftTimeTickBarrierInterval(t *testing.T) {
	interval := Params.SoftTimeTickBarrierInterval
	assert.Equal(t, interval, Timestamp(0x7d00000))
}

func TestParamTable_WriteNodeIDList(t *testing.T) {
	ids := Params.WriteNodeIDList
N
neza2017 已提交
108 109
	assert.Equal(t, len(ids), 1)
	assert.Equal(t, ids[0], int64(3))
110 111 112 113
}

func TestParamTable_WriteNodeTimeTickChannelNames(t *testing.T) {
	names := Params.WriteNodeTimeTickChannelNames
N
neza2017 已提交
114 115
	assert.Equal(t, len(names), 1)
	assert.Equal(t, names[0], "writeNodeTimeTick-3")
116 117 118 119
}

func TestParamTable_InsertChannelNames(t *testing.T) {
	names := Params.InsertChannelNames
X
XuanYang-cn 已提交
120
	assert.Equal(t, Params.TopicNum, len(names))
121 122 123 124
}

func TestParamTable_K2SChannelNames(t *testing.T) {
	names := Params.K2SChannelNames
N
neza2017 已提交
125
	assert.Equal(t, len(names), 1)
X
XuanYang-cn 已提交
126
	assert.Equal(t, names[0], "k2s-0")
127
}