From 13195d209c523d3d45f3456086bce61223950dab Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 8 Apr 2021 17:57:55 +0200 Subject: Fixed wrong implementation of yaml default values and of the corresponding tests --- pkg/config/config_test.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'pkg/config/config_test.go') diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index a4c170b..af18fc1 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -11,8 +11,8 @@ import ( func TestLoadFile(t *testing.T) { // Minimal yaml file minimalConfig := Config{ - Address: "127.0.0.2", - Port: "8082", + Address: "127.0.0.1", + Port: "8080", Token: "12345678-9abc-def0-1234-56789abcdef0", TrainStop: "ABCD:test:01", } @@ -25,6 +25,14 @@ func TestLoadFile(t *testing.T) { TrainStop: "VWXY_Z:test:90", } + // Complete yaml file + completeConfig := Config{ + Address: "127.0.0.2", + Port: "8082", + Token: "12345678-9abc-def0-1234-56789abcdef0", + TrainStop: "ABCD:test:01", + } + // Test cases testCases := []struct { name string @@ -41,6 +49,7 @@ func TestLoadFile(t *testing.T) { {"Invalid trainStop should fail to load", "test_data/invalid_trainStop.yaml", nil, &InvalidTrainStopError{}}, {"Minimal config", "test_data/minimal.yaml", &minimalConfig, nil}, {"Minimal config with resolving", "test_data/minimal_with_hostname.yaml", &minimalConfigWithResolving, nil}, + {"Complete config", "test_data/complete.yaml", &completeConfig, nil}, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { -- cgit v1.2.3