mirror of https://github.com/docker/cli.git
cli/compose/loader: TestMarshallConfig: fix duplicate version
The version was originally added in570ee9cb54
, at the time the `expected` config did not have a `version:` field. A later refactor in0cf2e6353a
updated the `expected` config to have a `version:` included. However, the test was not updated, which now resulted in the test using a compose file with a duplicate version field: version: '3.10' version: "3.10" services: foo: build: This issue was masked by `yaml.Unmarshal()` from `gopkg.in/yaml.v2` which silently ignores the duplicate, taking the value of the last occurrence. When upgrading to `gopkg.in/yaml.v3`, the duplicate value resulted in an error: yaml: unmarshal errors: line 2: mapping key "version" already defined at line 1 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
2b7d10cf93
commit
c18dd2719e
|
@ -19,8 +19,8 @@ func TestMarshallConfig(t *testing.T) {
|
|||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Equal(expected, string(actual)))
|
||||
|
||||
// Make sure the expected still
|
||||
dict, err := ParseYAML([]byte("version: '3.10'\n" + expected))
|
||||
// Make sure the expected can be parsed.
|
||||
dict, err := ParseYAML([]byte(expected))
|
||||
assert.NilError(t, err)
|
||||
_, err = Load(buildConfigDetails(dict, map[string]string{}))
|
||||
assert.NilError(t, err)
|
||||
|
|
Loading…
Reference in New Issue