docker_cli_links_unix_test.go 673 B

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