From 4c151bdf8fbaa3743d8772430bcf41994db3da4d Mon Sep 17 00:00:00 2001 From: Michael Engelhardt Date: Thu, 19 Nov 2020 20:03:30 +0100 Subject: [PATCH] add test for invalid port in config file --- config/config_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/config/config_test.go b/config/config_test.go index 61952d9d..d1a4a428 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -219,6 +219,23 @@ services: } } +func TestParseAndValidateConfigBytesWithInvalidPort(t *testing.T) { + defer func() { recover() }() + + parseAndValidateConfigBytes([]byte(` +web: + port: 65536 + address: 127.0.0.1 +services: + - name: twinnation + url: https://twinnation.org/actuator/health + conditions: + - "[STATUS] == 200" +`)) + + t.Fatal("Should've panicked because the configuration specifies an invalid port value") +} + func TestParseAndValidateConfigBytesWithMetrics(t *testing.T) { config, err := parseAndValidateConfigBytes([]byte(` metrics: true