Skip to content

Commit

Permalink
Add ApplyEnvVars test to observations config
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Robert Ignat <robert.ignat91@gmail.com>
  • Loading branch information
roignpar committed Feb 18, 2019
1 parent 50844b9 commit 06482e5
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions observations/config_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package observations

import (
"os"
"testing"
)

func TestApplyEnvVars(t *testing.T) {
os.Setenv("CLUSTER_METRICS_ENABLESTATS", "true")
mcfg := &MetricsConfig{}
mcfg.Default()
mcfg.ApplyEnvVars()

if !mcfg.EnableStats {
t.Fatal("failed to override enable_stats with env var")
}

os.Setenv("CLUSTER_TRACING_ENABLETRACING", "true")
tcfg := &TracingConfig{}
tcfg.Default()
tcfg.ApplyEnvVars()

if !tcfg.EnableTracing {
t.Fatal("failed to override enable_tracing with env var")
}
}

0 comments on commit 06482e5

Please sign in to comment.