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