2015-07-08 20:30:03 +00:00
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io/ioutil"
|
|
|
|
"os"
|
|
|
|
|
2015-10-08 15:56:51 +00:00
|
|
|
"github.com/docker/docker/pkg/integration/checker"
|
2015-07-08 20:30:03 +00:00
|
|
|
"github.com/go-check/check"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (s *DockerSuite) TestLinksEtcHostsContentMatch(c *check.C) {
|
2015-09-01 16:10:24 +00:00
|
|
|
// In a _unix file as using Unix specific files, and must be on the
|
|
|
|
// same host as the daemon.
|
2015-09-18 17:41:12 +00:00
|
|
|
testRequires(c, SameHostDaemon, NotUserNamespace)
|
2015-07-08 20:30:03 +00:00
|
|
|
|
2015-07-20 06:44:22 +00:00
|
|
|
out, _ := dockerCmd(c, "run", "--net=host", "busybox", "cat", "/etc/hosts")
|
2015-07-08 20:30:03 +00:00
|
|
|
hosts, err := ioutil.ReadFile("/etc/hosts")
|
|
|
|
if os.IsNotExist(err) {
|
|
|
|
c.Skip("/etc/hosts does not exist, skip this test")
|
|
|
|
}
|
|
|
|
|
2015-10-08 15:56:51 +00:00
|
|
|
c.Assert(out, checker.Equals, string(hosts), check.Commentf("container: %s\n\nhost:%s", out, hosts))
|
2015-07-08 20:30:03 +00:00
|
|
|
|
|
|
|
}
|