From 14ac4dfeca66a12f0ffaee8d0ecaebc2828a0be3 Mon Sep 17 00:00:00 2001 From: TwinProduction Date: Mon, 9 Sep 2019 22:21:18 -0400 Subject: [PATCH] Add test for default parameters --- config/config_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/config/config_test.go b/config/config_test.go index 556f2861..fbe9e9e9 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -50,3 +50,22 @@ services: t.Errorf("There should have been %d conditions", 2) } } + +func TestParseConfigBytesDefault(t *testing.T) { + config := ParseConfigBytes([]byte(` +services: + - name: twinnation + url: https://twinnation.org/actuator/health + conditions: + - "$STATUS == 200" +`)) + if config.Services[0].Url != "https://twinnation.org/actuator/health" { + t.Errorf("URL should have been %s", "https://twinnation.org/actuator/health") + } + if config.Services[0].Interval != 10*time.Second { + t.Errorf("Interval should have been %s, because it is the default value", 10*time.Second) + } + if config.Services[0].FailureThreshold != 1 { + t.Errorf("FailureThreshold should have been %d, because it is the default value", 1) + } +}