github.com/docker/Engine@v17.12.1-ce-rc2+incompatible/integration-cli/docker_deprecated_api_v124_unix_test.go (about) 1 // +build !windows 2 3 package main 4 5 import ( 6 "fmt" 7 8 "github.com/docker/docker/integration-cli/checker" 9 "github.com/docker/docker/integration-cli/request" 10 "github.com/go-check/check" 11 ) 12 13 // #19100 This is a deprecated feature test, it should be removed in Docker 1.12 14 func (s *DockerNetworkSuite) TestDeprecatedDockerNetworkStartAPIWithHostconfig(c *check.C) { 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 c.Assert(err, checker.IsNil) 27 c.Assert(waitRun(conName), checker.IsNil) 28 networks := inspectField(c, conName, "NetworkSettings.Networks") 29 c.Assert(networks, checker.Contains, netName, check.Commentf(fmt.Sprintf("Should contain '%s' network", netName))) 30 c.Assert(networks, checker.Not(checker.Contains), "bridge", check.Commentf("Should not contain 'bridge' network")) 31 }