0a8386c8 |
// +build !windows
package main
import ( |
6345208b |
"strings" |
59e55dcd |
"testing" |
0a8386c8 |
|
b37c214e |
"github.com/docker/docker/testutil/request" |
9f0b3f56 |
"gotest.tools/v3/assert" |
0a8386c8 |
)
// #19100 This is a deprecated feature test, it should be removed in Docker 1.12 |
1d92789b |
func (s *DockerNetworkSuite) TestDeprecatedDockerNetworkStartAPIWithHostconfig(c *testing.T) { |
0a8386c8 |
netName := "test"
conName := "foo"
dockerCmd(c, "network", "create", netName)
dockerCmd(c, "create", "--name", conName, "busybox", "top")
config := map[string]interface{}{
"HostConfig": map[string]interface{}{
"NetworkMode": netName,
},
} |
0fd5a654 |
_, _, err := request.Post(formatV123StartAPIURL("/containers/"+conName+"/start"), request.JSONBody(config)) |
6345208b |
assert.NilError(c, err)
assert.NilError(c, waitRun(conName)) |
0a8386c8 |
networks := inspectField(c, conName, "NetworkSettings.Networks") |
6345208b |
assert.Assert(c, strings.Contains(networks, netName), "Should contain '%s' network", netName)
assert.Assert(c, !strings.Contains(networks, "bridge"), "Should not contain 'bridge' network") |
0a8386c8 |
} |