docker_cli_links_unix_test.go 600 B

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