docker_deprecated_api_v124_unix_test.go 1.0 KB

123456789101112131415161718192021222324252627282930
  1. // +build !windows
  2. package main
  3. import (
  4. "fmt"
  5. "github.com/docker/docker/pkg/integration/checker"
  6. "github.com/go-check/check"
  7. )
  8. // #19100 This is a deprecated feature test, it should be removed in Docker 1.12
  9. func (s *DockerNetworkSuite) TestDeprecatedDockerNetworkStartAPIWithHostconfig(c *check.C) {
  10. netName := "test"
  11. conName := "foo"
  12. dockerCmd(c, "network", "create", netName)
  13. dockerCmd(c, "create", "--name", conName, "busybox", "top")
  14. config := map[string]interface{}{
  15. "HostConfig": map[string]interface{}{
  16. "NetworkMode": netName,
  17. },
  18. }
  19. _, _, err := sockRequest("POST", formatV123StartAPIURL("/containers/"+conName+"/start"), config)
  20. c.Assert(err, checker.IsNil)
  21. c.Assert(waitRun(conName), checker.IsNil)
  22. networks := inspectField(c, conName, "NetworkSettings.Networks")
  23. c.Assert(networks, checker.Contains, netName, check.Commentf(fmt.Sprintf("Should contain '%s' network", netName)))
  24. c.Assert(networks, checker.Not(checker.Contains), "bridge", check.Commentf("Should not contain 'bridge' network"))
  25. }