Address review comments

This commit is contained in:
Preetha Appan 2019-03-29 08:56:25 -05:00
parent e0566237a4
commit 71e6550f81
No known key found for this signature in database
GPG key ID: 9F7C19990A50EAFC
7 changed files with 4 additions and 4 deletions

View file

@ -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)

View file

@ -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)
}

View file

@ -1,3 +1,4 @@
# This file was used to generate basic.json from https://www.hcl2json.com/
region = "foobar"
datacenter = "dc2"
name = "my-web"