github.com/jfrazelle/docker@v1.1.2-0.20210712172922-bf78e25fe508/integration-cli/docker_deprecated_api_v124_unix_test.go (about) 1 // +build !windows 2 3 package main 4 5 import ( 6 "strings" 7 "testing" 8 9 "github.com/docker/docker/testutil/request" 10 "gotest.tools/v3/assert" 11 ) 12 13 // #19100 This is a deprecated feature test, it should be removed in Docker 1.12 14 func (s *DockerNetworkSuite) TestDeprecatedDockerNetworkStartAPIWithHostconfig(c *testing.T) { 15 netName := "test" 16 conName := "foo" 17 dockerCmd(c, "network", "create", netName) 18 dockerCmd(c, "create", "--name", conName, "busybox", "top") 19 20 config := map[string]interface{}{ 21 "HostConfig": map[string]interface{}{ 22 "NetworkMode": netName, 23 }, 24 } 25 _, _, err := request.Post(formatV123StartAPIURL("/containers/"+conName+"/start"), request.JSONBody(config)) 26 assert.NilError(c, err) 27 assert.NilError(c, waitRun(conName)) 28 networks := inspectField(c, conName, "NetworkSettings.Networks") 29 assert.Assert(c, strings.Contains(networks, netName), "Should contain '%s' network", netName) 30 assert.Assert(c, !strings.Contains(networks, "bridge"), "Should not contain 'bridge' network") 31 }