ipfs-cluster/observations/config_test.go
Robert Ignat 06482e5fce Add ApplyEnvVars test to observations config
License: MIT
Signed-off-by: Robert Ignat <robert.ignat91@gmail.com>
2019-02-18 17:51:39 +02:00

27 lines
496 B
Go

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")
}
}