Skip to content

Commit

Permalink
Merge pull request moby#49188 from thaJeztah/go1.24_prep
Browse files Browse the repository at this point in the history
daemon: adjust tests for changes in go1.24 JSON errors
  • Loading branch information
thaJeztah authored Jan 1, 2025
2 parents 0e10cd6 + 1c37a44 commit d01dd98
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions daemon/config/config_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func TestDaemonConfigurationFeatures(t *testing.T) {
{
name: "invalid config value",
config: `{"features": {"containerd-snapshotter": "not-a-boolean"}}`,
expectedErr: `json: cannot unmarshal string into Go struct field Config.features of type bool`,
expectedErr: `json: cannot unmarshal string into Go struct field`,
},
}

Expand All @@ -179,7 +179,7 @@ func TestDaemonConfigurationFeatures(t *testing.T) {
}
cc, err := MergeDaemonConfigurations(c, flags, configFile)
if tc.expectedErr != "" {
assert.Error(t, err, tc.expectedErr)
assert.ErrorContains(t, err, tc.expectedErr)
} else {
assert.NilError(t, err)
assert.Check(t, is.DeepEqual(tc.expectedValue, cc.Features))
Expand Down Expand Up @@ -304,7 +304,7 @@ func TestDaemonConfigurationHostGatewayIP(t *testing.T) {
{
name: "config not array",
config: `{"host-gateway-ips": "192.0.2.1"}`,
expErr: `json: cannot unmarshal string into Go struct field Config.host-gateway-ips of type []netip.Addr`,
expErr: `json: cannot unmarshal string into Go struct field`,
},
{
name: "config old and new",
Expand Down Expand Up @@ -351,7 +351,7 @@ func TestDaemonConfigurationHostGatewayIP(t *testing.T) {
}
cc, err := MergeDaemonConfigurations(c, flags, configFile)
if tc.expErr != "" {
assert.Check(t, is.Error(err, tc.expErr))
assert.Check(t, is.ErrorContains(err, tc.expErr))
assert.Check(t, is.Nil(cc))
} else {
assert.NilError(t, err)
Expand Down

0 comments on commit d01dd98

Please sign in to comment.