From 08580c3d5c094dc5f238a2a97e675a15509320b5 Mon Sep 17 00:00:00 2001 From: Robert Ignat Date: Mon, 18 Feb 2019 17:45:29 +0200 Subject: [PATCH] Add ApplyEnvVars test to disk config License: MIT Signed-off-by: Robert Ignat --- informer/disk/config_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/informer/disk/config_test.go b/informer/disk/config_test.go index eb660dbd..27aeb99b 100644 --- a/informer/disk/config_test.go +++ b/informer/disk/config_test.go @@ -2,7 +2,9 @@ package disk import ( "encoding/json" + "os" "testing" + "time" ) var cfgJSON = []byte(` @@ -81,3 +83,13 @@ func TestDefault(t *testing.T) { t.Fatal("MetricRepoSize is a valid type") } } + +func TestApplyEnvVars(t *testing.T) { + os.Setenv("CLUSTER_DISK_METRICTTL", "22s") + cfg := &Config{} + cfg.ApplyEnvVars() + + if cfg.MetricTTL != 22*time.Second { + t.Fatal("failed to override metric_ttl with env var") + } +}