Files
docker-cli/components/engine/daemon/create_test.go
Yong Tang a53f2c40a3 Verify NetworkingConfig to make sure EndpointSettings is not nil
This fix tries to address the issue raised in 35752
where container start will trigger a crash if EndpointSettings is nil.

This fix adds the validation to make sure EndpointSettings != nil

This fix fixes 35752.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 8d2f4cb24129d87674a13319ca48ce8636ee527a
Component: engine
2018-01-22 16:31:10 +00:00

22 lines
496 B
Go

package daemon
import (
"testing"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/errdefs"
"github.com/stretchr/testify/assert"
)
// Test case for 35752
func TestVerifyNetworkingConfig(t *testing.T) {
name := "mynet"
endpoints := make(map[string]*network.EndpointSettings, 1)
endpoints[name] = nil
nwConfig := &network.NetworkingConfig{
EndpointsConfig: endpoints,
}
err := verifyNetworkingConfig(nwConfig)
assert.True(t, errdefs.IsInvalidParameter(err))
}