Merge pull request #46144 from akerouanton/verifyNetworkingConfig-unneeded-error-wrapping
daemon: Remove unneeded error wrapping in verifyNetworkingConfig
This commit is contained in:
commit
01a9c5b70e
2 changed files with 3 additions and 3 deletions
|
@ -326,7 +326,7 @@ func verifyNetworkingConfig(nwConfig *networktypes.NetworkingConfig) error {
|
||||||
|
|
||||||
for k, v := range nwConfig.EndpointsConfig {
|
for k, v := range nwConfig.EndpointsConfig {
|
||||||
if v == nil {
|
if v == nil {
|
||||||
return errdefs.InvalidParameter(errors.Errorf("no EndpointSettings for %s", k))
|
return errors.Errorf("no EndpointSettings for %s", k)
|
||||||
}
|
}
|
||||||
if v.IPAMConfig != nil {
|
if v.IPAMConfig != nil {
|
||||||
if v.IPAMConfig.IPv4Address != "" && net.ParseIP(v.IPAMConfig.IPv4Address).To4() == nil {
|
if v.IPAMConfig.IPv4Address != "" && net.ParseIP(v.IPAMConfig.IPv4Address).To4() == nil {
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/network"
|
"github.com/docker/docker/api/types/network"
|
||||||
"github.com/docker/docker/errdefs"
|
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
|
is "gotest.tools/v3/assert/cmp"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Test case for 35752
|
// Test case for 35752
|
||||||
|
@ -17,5 +17,5 @@ func TestVerifyNetworkingConfig(t *testing.T) {
|
||||||
EndpointsConfig: endpoints,
|
EndpointsConfig: endpoints,
|
||||||
}
|
}
|
||||||
err := verifyNetworkingConfig(nwConfig)
|
err := verifyNetworkingConfig(nwConfig)
|
||||||
assert.Check(t, errdefs.IsInvalidParameter(err))
|
assert.Check(t, is.Error(err, "no EndpointSettings for mynet"), "should produce an error because no EndpointSettings were passed")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue