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 (
|
||||
"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")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user