Add ApplyEnvVars test to observations config
License: MIT Signed-off-by: Robert Ignat <robert.ignat91@gmail.com>
This commit is contained in:
parent
50844b9e5b
commit
06482e5fce
26
observations/config_test.go
Normal file
26
observations/config_test.go
Normal file
|
@ -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")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user