diff --git a/command/agent/config_parse_test.go b/command/agent/config_parse_test.go index 9774b0db3..adff7035b 100644 --- a/command/agent/config_parse_test.go +++ b/command/agent/config_parse_test.go @@ -3,10 +3,12 @@ package agent import ( "path/filepath" "reflect" + "strings" "testing" "time" "github.com/hashicorp/nomad/nomad/structs/config" + "github.com/kr/pretty" ) func TestConfig_Parse(t *testing.T) { @@ -75,6 +77,7 @@ func TestConfig_Parse(t *testing.T) { GCParallelDestroys: 6, GCDiskUsageThreshold: 82, GCInodeUsageThreshold: 91, + GCMaxAllocs: 50, NoHostUUID: true, }, Server: &ServerConfig{ @@ -165,22 +168,20 @@ func TestConfig_Parse(t *testing.T) { } for _, tc := range cases { - t.Logf("Testing parse: %s", tc.File) + t.Run(tc.File, func(t *testing.T) { + path, err := filepath.Abs(filepath.Join("./config-test-fixtures", tc.File)) + if err != nil { + t.Fatalf("file: %s\n\n%s", tc.File, err) + } - path, err := filepath.Abs(filepath.Join("./config-test-fixtures", tc.File)) - if err != nil { - t.Fatalf("file: %s\n\n%s", tc.File, err) - continue - } + actual, err := ParseConfigFile(path) + if (err != nil) != tc.Err { + t.Fatalf("file: %s\n\n%s", tc.File, err) + } - actual, err := ParseConfigFile(path) - if (err != nil) != tc.Err { - t.Fatalf("file: %s\n\n%s", tc.File, err) - continue - } - - if !reflect.DeepEqual(actual, tc.Result) { - t.Fatalf("file: %s\n\n%#v\n\n%#v", tc.File, actual, tc.Result) - } + if !reflect.DeepEqual(actual, tc.Result) { + t.Errorf("file: %s diff: (actual vs expected)\n\n%s", tc.File, strings.Join(pretty.Diff(actual, tc.Result), "\n")) + } + }) } }