github.com/damirazo/docker@v1.9.0/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/go-check/check"
    10  )
    11  
    12  func (s *DockerSuite) TestLinksEtcHostsContentMatch(c *check.C) {
    13  	// In a _unix file as using Unix specific files, and must be on the
    14  	// same host as the daemon.
    15  	testRequires(c, SameHostDaemon, NotUserNamespace)
    16  
    17  	out, _ := dockerCmd(c, "run", "--net=host", "busybox", "cat", "/etc/hosts")
    18  	hosts, err := ioutil.ReadFile("/etc/hosts")
    19  	if os.IsNotExist(err) {
    20  		c.Skip("/etc/hosts does not exist, skip this test")
    21  	}
    22  
    23  	if out != string(hosts) {
    24  		c.Errorf("container: %s\n\nhost:%s", out, hosts)
    25  	}
    26  
    27  }