diff --git a/command/agent/config_parse.go b/command/agent/config_parse.go index f26d82ae6..f46fb0894 100644 --- a/command/agent/config_parse.go +++ b/command/agent/config_parse.go @@ -1015,9 +1015,8 @@ func parsePlugins(result *[]*config.PluginConfig, list *ast.ObjectList) error { listVal := list.Items[i] // Deal with json->hcl AST parsing incorrectness when directly nested - // items show up as additional keys. This currently only affects plugin - // configuration because args is not necessary. All other fields in the config - // have multiple keys and parse from json into the AST correctly. + // items show up as additional keys. + // TODO(preetha): Add additional tests and fix other places that have the same issue unwrapLegacyHCLObjectKeysFromJSON(listVal, 1) if err := helper.CheckHCLKeys(listVal.Val, valid); err != nil { return fmt.Errorf("invalid keys in plugin config %d: %v", i+1, err) diff --git a/command/agent/config_parse_test.go b/command/agent/config_parse_test.go index 84b0de9e0..b58f89730 100644 --- a/command/agent/config_parse_test.go +++ b/command/agent/config_parse_test.go @@ -657,7 +657,7 @@ func TestConfig_Parse(t *testing.T) { for _, tc := range cases { t.Run(tc.File, func(t *testing.T) { require := require.New(t) - path, err := filepath.Abs(filepath.Join("./config-test-fixtures", tc.File)) + path, err := filepath.Abs(filepath.Join("./testdata", tc.File)) if err != nil { t.Fatalf("file: %s\n\n%s", tc.File, err) } diff --git a/command/agent/config-test-fixtures/basic.hcl b/command/agent/testdata/basic.hcl similarity index 98% rename from command/agent/config-test-fixtures/basic.hcl rename to command/agent/testdata/basic.hcl index 96bf9d9c6..a80ff634a 100644 --- a/command/agent/config-test-fixtures/basic.hcl +++ b/command/agent/testdata/basic.hcl @@ -1,3 +1,4 @@ +# This file was used to generate basic.json from https://www.hcl2json.com/ region = "foobar" datacenter = "dc2" name = "my-web" diff --git a/command/agent/config-test-fixtures/basic.json b/command/agent/testdata/basic.json similarity index 100% rename from command/agent/config-test-fixtures/basic.json rename to command/agent/testdata/basic.json diff --git a/command/agent/config-test-fixtures/non-optional.hcl b/command/agent/testdata/non-optional.hcl similarity index 100% rename from command/agent/config-test-fixtures/non-optional.hcl rename to command/agent/testdata/non-optional.hcl diff --git a/command/agent/config-test-fixtures/plugin.hcl b/command/agent/testdata/plugin.hcl similarity index 100% rename from command/agent/config-test-fixtures/plugin.hcl rename to command/agent/testdata/plugin.hcl diff --git a/command/agent/config-test-fixtures/plugin.json b/command/agent/testdata/plugin.json similarity index 100% rename from command/agent/config-test-fixtures/plugin.json rename to command/agent/testdata/plugin.json