Add ApplyEnvVars test to raft config

License: MIT
Signed-off-by: Robert Ignat <robert.ignat91@gmail.com>
This commit is contained in:
Robert Ignat 2019-02-18 17:43:54 +02:00
parent 36ee0f84eb
commit bac982c5aa

View File

@ -2,6 +2,7 @@ package raft
import (
"encoding/json"
"os"
"testing"
hraft "github.com/hashicorp/raft"
@ -106,3 +107,14 @@ func TestDefault(t *testing.T) {
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")
}
}