-
Notifications
You must be signed in to change notification settings - Fork 74
Closed
Description
Describe the bug
When trying to override non-primitive (arrays or objects) elements of an attributes field, this fails with the following error:
merging an object in json but data type is not struct, instead is: map
To Reproduce
Steps to reproduce the behavior:
- Create a new folder
pkg/utils/overriding/test-fixtures/patches/command-with-attributesin the repository - Cteate the following 3 files inside this new repository:
original.yaml:
commands:
- attributes:
objectAttributeToReplaceFully:
attributeField: 9.9
apply:
component: "mycomponent"
id: command-with-attributes-changedpatch.yaml:
commands:
- attributes:
objectAttributeToReplaceFully:
newAttributeField: newAttributeFieldValue
apply: {}
id: command-with-attributes-changedresult.yaml:
commands:
- attributes:
objectAttributeToReplaceFully:
newAttributeField: newAttributeFieldValue
apply:
component: "mycomponent"
id: command-with-attributes-changed- In the file
pkg/utils/overriding/overriding_test.go, replace the following line (311):
t.Error("Received error but did not expect one")by
t.Error("Received error but did not expect one" + actual)- Run the overriding test at the root of the project:
go test ./pkg/utils/overriding- See the error in the Go test result:
--- FAIL: TestOverridingPatches (0.00s)
--- FAIL: TestOverridingPatches/command-with-attributes (0.00s)
overriding_test.go:311: Received error but did not expect onemerging an object in json but data type is not struct, instead is: map
FAIL
FAIL github.com/devfile/api/pkg/utils/overriding 0.008s
FAIL
Expected behavior
The result of the attribute override should be the one described in the result.yaml file above.
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't workingSomething isn't working