mirror of https://github.com/status-im/consul.git
agent: test retry join config
This commit is contained in:
parent
6d75fc8fb2
commit
4bc4ba2d09
|
@ -265,6 +265,37 @@ func TestDecodeConfig(t *testing.T) {
|
||||||
t.Fatalf("bad: %#v", config)
|
t.Fatalf("bad: %#v", config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Retry join
|
||||||
|
input = `{"retry_join": ["1.1.1.1", "2.2.2.2"]}`
|
||||||
|
config, err = DecodeConfig(bytes.NewReader([]byte(input)))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("err: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(config.RetryJoin) != 2 {
|
||||||
|
t.Fatalf("bad: %#v", config)
|
||||||
|
}
|
||||||
|
if config.RetryJoin[0] != "1.1.1.1" {
|
||||||
|
t.Fatalf("bad: %#v", config)
|
||||||
|
}
|
||||||
|
if config.RetryJoin[1] != "2.2.2.2" {
|
||||||
|
t.Fatalf("bad: %#v", config)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retry interval
|
||||||
|
input = `{"retry_interval": "10s"}`
|
||||||
|
config, err = DecodeConfig(bytes.NewReader([]byte(input)))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("err: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if config.RetryIntervalRaw != "10s" {
|
||||||
|
t.Fatalf("bad: %#v", config)
|
||||||
|
}
|
||||||
|
if config.RetryInterval.String() != "10s" {
|
||||||
|
t.Fatalf("bad: %#v", config)
|
||||||
|
}
|
||||||
|
|
||||||
// UI Dir
|
// UI Dir
|
||||||
input = `{"ui_dir": "/opt/consul-ui"}`
|
input = `{"ui_dir": "/opt/consul-ui"}`
|
||||||
config, err = DecodeConfig(bytes.NewReader([]byte(input)))
|
config, err = DecodeConfig(bytes.NewReader([]byte(input)))
|
||||||
|
@ -561,6 +592,7 @@ func TestMergeConfig(t *testing.T) {
|
||||||
SkipLeaveOnInt: false,
|
SkipLeaveOnInt: false,
|
||||||
EnableDebug: false,
|
EnableDebug: false,
|
||||||
CheckUpdateIntervalRaw: "8m",
|
CheckUpdateIntervalRaw: "8m",
|
||||||
|
RetryIntervalRaw: "10s",
|
||||||
}
|
}
|
||||||
|
|
||||||
b := &Config{
|
b := &Config{
|
||||||
|
@ -611,6 +643,9 @@ func TestMergeConfig(t *testing.T) {
|
||||||
UiDir: "/opt/consul-ui",
|
UiDir: "/opt/consul-ui",
|
||||||
EnableSyslog: true,
|
EnableSyslog: true,
|
||||||
RejoinAfterLeave: true,
|
RejoinAfterLeave: true,
|
||||||
|
RetryJoin: []string{"1.1.1.1"},
|
||||||
|
RetryIntervalRaw: "10s",
|
||||||
|
RetryInterval: 10 * time.Second,
|
||||||
CheckUpdateInterval: 8 * time.Minute,
|
CheckUpdateInterval: 8 * time.Minute,
|
||||||
CheckUpdateIntervalRaw: "8m",
|
CheckUpdateIntervalRaw: "8m",
|
||||||
ACLToken: "1234",
|
ACLToken: "1234",
|
||||||
|
|
Loading…
Reference in New Issue