Add ApplyEnvVars test to raft config
License: MIT Signed-off-by: Robert Ignat <robert.ignat91@gmail.com>
This commit is contained in:
parent
36ee0f84eb
commit
bac982c5aa
|
@ -2,6 +2,7 @@ package raft
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
hraft "github.com/hashicorp/raft"
|
hraft "github.com/hashicorp/raft"
|
||||||
|
@ -106,3 +107,14 @@ func TestDefault(t *testing.T) {
|
||||||
t.Fatal("expected error validating")
|
t.Fatal("expected error validating")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestApplyEnvVars(t *testing.T) {
|
||||||
|
os.Setenv("CLUSTER_RAFT_COMMITRETRIES", "300")
|
||||||
|
cfg := &Config{}
|
||||||
|
cfg.Default()
|
||||||
|
cfg.ApplyEnvVars()
|
||||||
|
|
||||||
|
if cfg.CommitRetries != 300 {
|
||||||
|
t.Fatal("failed to override commit_retries with env var")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user