moby/integration-cli/docker_cli_links_unix_test.go
Zhang Wei 97b9223a1f use of checkers on Integration test
Part of #16756

Use c.Assert instead of condition judgement.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2015-10-18 09:00:08 +08:00

26 lines
673 B
Go

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