Skip to content

Commit

Permalink
Merge pull request moby#15980 from Microsoft/unix-links-test
Browse files Browse the repository at this point in the history
Moved unix links tests to non-platform
  • Loading branch information
LK4D4 committed Sep 1, 2015
2 parents 2093616 + 4fccf8a commit 82415ad
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
15 changes: 15 additions & 0 deletions integration-cli/docker_cli_links_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
19 changes: 2 additions & 17 deletions integration-cli/docker_cli_links_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
}

}

0 comments on commit 82415ad

Please sign in to comment.