github.com/resin-io/docker@v1.13.1/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/pkg/integration/checker"
     9  	"github.com/go-check/check"
    10  )
    11  
    12  // #19100 This is a deprecated feature test, it should be removed in Docker 1.12
    13  func (s *DockerNetworkSuite) TestDeprecatedDockerNetworkStartAPIWithHostconfig(c *check.C) {
    14  	netName := "test"
    15  	conName := "foo"
    16  	dockerCmd(c, "network", "create", netName)
    17  	dockerCmd(c, "create", "--name", conName, "busybox", "top")
    18  
    19  	config := map[string]interface{}{
    20  		"HostConfig": map[string]interface{}{
    21  			"NetworkMode": netName,
    22  		},
    23  	}
    24  	_, _, err := sockRequest("POST", formatV123StartAPIURL("/containers/"+conName+"/start"), config)
    25  	c.Assert(err, checker.IsNil)
    26  	c.Assert(waitRun(conName), checker.IsNil)
    27  	networks := inspectField(c, conName, "NetworkSettings.Networks")
    28  	c.Assert(networks, checker.Contains, netName, check.Commentf(fmt.Sprintf("Should contain '%s' network", netName)))
    29  	c.Assert(networks, checker.Not(checker.Contains), "bridge", check.Commentf("Should not contain 'bridge' network"))
    30  }