github.com/ssdev-go/moby@v17.12.1-ce-rc2+incompatible/integration-cli/docker_cli_links_unix_test.go (about)

     1  // +build !windows
     2  
     3  package main
     4  
     5  import (
     6  	"io/ioutil"
     7  	"os"
     8  
     9  	"github.com/docker/docker/integration-cli/checker"
    10  	"github.com/go-check/check"
    11  )
    12  
    13  func (s *DockerSuite) TestLinksEtcHostsContentMatch(c *check.C) {
    14  	// In a _unix file as using Unix specific files, and must be on the
    15  	// same host as the daemon.
    16  	testRequires(c, SameHostDaemon, NotUserNamespace)
    17  
    18  	out, _ := dockerCmd(c, "run", "--net=host", "busybox", "cat", "/etc/hosts")
    19  	hosts, err := ioutil.ReadFile("/etc/hosts")
    20  	if os.IsNotExist(err) {
    21  		c.Skip("/etc/hosts does not exist, skip this test")
    22  	}
    23  
    24  	c.Assert(out, checker.Equals, string(hosts), check.Commentf("container: %s\n\nhost:%s", out, hosts))
    25  
    26  }