From 4fccf8adfa50855afa0ffaed1ea5c22ddaa7b2e4 Mon Sep 17 00:00:00 2001 From: John Howard Date: Tue, 1 Sep 2015 09:10:24 -0700 Subject: [PATCH] Moved unix links tests to non-platform Signed-off-by: John Howard --- integration-cli/docker_cli_links_test.go | 15 +++++++++++++++ integration-cli/docker_cli_links_unix_test.go | 19 ++----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/integration-cli/docker_cli_links_test.go b/integration-cli/docker_cli_links_test.go index 10630bf05c..e6ed8dc98b 100644 --- a/integration-cli/docker_cli_links_test.go +++ b/integration-cli/docker_cli_links_test.go @@ -225,3 +225,18 @@ func (s *DockerSuite) TestLinkShortDefinition(c *check.C) { c.Assert(err, check.IsNil) c.Assert(links, check.Equals, "[\"/shortlinkdef:/link2/shortlinkdef\"]") } + +func (s *DockerSuite) TestLinksNetworkHostContainer(c *check.C) { + dockerCmd(c, "run", "-d", "--net", "host", "--name", "host_container", "busybox", "top") + out, _, err := dockerCmdWithError("run", "--name", "should_fail", "--link", "host_container:tester", "busybox", "true") + if err == nil || !strings.Contains(out, "--net=host can't be used with links. This would result in undefined behavior") { + c.Fatalf("Running container linking to a container with --net host should have failed: %s", out) + } +} + +func (s *DockerSuite) TestLinksEtcHostsRegularFile(c *check.C) { + out, _ := dockerCmd(c, "run", "--net=host", "busybox", "ls", "-la", "/etc/hosts") + if !strings.HasPrefix(out, "-") { + c.Errorf("/etc/hosts should be a regular file") + } +} diff --git a/integration-cli/docker_cli_links_unix_test.go b/integration-cli/docker_cli_links_unix_test.go index 355b2bbc65..9ae203272f 100644 --- a/integration-cli/docker_cli_links_unix_test.go +++ b/integration-cli/docker_cli_links_unix_test.go @@ -5,19 +5,13 @@ package main import ( "io/ioutil" "os" - "strings" "github.com/go-check/check" ) -func (s *DockerSuite) TestLinksEtcHostsRegularFile(c *check.C) { - out, _ := dockerCmd(c, "run", "--net=host", "busybox", "ls", "-la", "/etc/hosts") - if !strings.HasPrefix(out, "-") { - c.Errorf("/etc/hosts should be a regular file") - } -} - 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) out, _ := dockerCmd(c, "run", "--net=host", "busybox", "cat", "/etc/hosts") @@ -31,12 +25,3 @@ func (s *DockerSuite) TestLinksEtcHostsContentMatch(c *check.C) { } } - -func (s *DockerSuite) TestLinksNetworkHostContainer(c *check.C) { - dockerCmd(c, "run", "-d", "--net", "host", "--name", "host_container", "busybox", "top") - out, _, err := dockerCmdWithError("run", "--name", "should_fail", "--link", "host_container:tester", "busybox", "true") - if err == nil || !strings.Contains(out, "--net=host can't be used with links. This would result in undefined behavior") { - c.Fatalf("Running container linking to a container with --net host should have failed: %s", out) - } - -}