Signed-off-by: John Howard <jhoward@microsoft.com>
John Howard authored on 2015/09/02 01:10:24... | ... |
@@ -225,3 +225,18 @@ func (s *DockerSuite) TestLinkShortDefinition(c *check.C) { |
225 | 225 |
c.Assert(err, check.IsNil) |
226 | 226 |
c.Assert(links, check.Equals, "[\"/shortlinkdef:/link2/shortlinkdef\"]") |
227 | 227 |
} |
228 |
+ |
|
229 |
+func (s *DockerSuite) TestLinksNetworkHostContainer(c *check.C) { |
|
230 |
+ dockerCmd(c, "run", "-d", "--net", "host", "--name", "host_container", "busybox", "top") |
|
231 |
+ out, _, err := dockerCmdWithError("run", "--name", "should_fail", "--link", "host_container:tester", "busybox", "true") |
|
232 |
+ if err == nil || !strings.Contains(out, "--net=host can't be used with links. This would result in undefined behavior") { |
|
233 |
+ c.Fatalf("Running container linking to a container with --net host should have failed: %s", out) |
|
234 |
+ } |
|
235 |
+} |
|
236 |
+ |
|
237 |
+func (s *DockerSuite) TestLinksEtcHostsRegularFile(c *check.C) { |
|
238 |
+ out, _ := dockerCmd(c, "run", "--net=host", "busybox", "ls", "-la", "/etc/hosts") |
|
239 |
+ if !strings.HasPrefix(out, "-") { |
|
240 |
+ c.Errorf("/etc/hosts should be a regular file") |
|
241 |
+ } |
|
242 |
+} |
... | ... |
@@ -5,19 +5,13 @@ package main |
5 | 5 |
import ( |
6 | 6 |
"io/ioutil" |
7 | 7 |
"os" |
8 |
- "strings" |
|
9 | 8 |
|
10 | 9 |
"github.com/go-check/check" |
11 | 10 |
) |
12 | 11 |
|
13 |
-func (s *DockerSuite) TestLinksEtcHostsRegularFile(c *check.C) { |
|
14 |
- out, _ := dockerCmd(c, "run", "--net=host", "busybox", "ls", "-la", "/etc/hosts") |
|
15 |
- if !strings.HasPrefix(out, "-") { |
|
16 |
- c.Errorf("/etc/hosts should be a regular file") |
|
17 |
- } |
|
18 |
-} |
|
19 |
- |
|
20 | 12 |
func (s *DockerSuite) TestLinksEtcHostsContentMatch(c *check.C) { |
13 |
+ // In a _unix file as using Unix specific files, and must be on the |
|
14 |
+ // same host as the daemon. |
|
21 | 15 |
testRequires(c, SameHostDaemon) |
22 | 16 |
|
23 | 17 |
out, _ := dockerCmd(c, "run", "--net=host", "busybox", "cat", "/etc/hosts") |
... | ... |
@@ -31,12 +25,3 @@ func (s *DockerSuite) TestLinksEtcHostsContentMatch(c *check.C) { |
31 | 31 |
} |
32 | 32 |
|
33 | 33 |
} |
34 |
- |
|
35 |
-func (s *DockerSuite) TestLinksNetworkHostContainer(c *check.C) { |
|
36 |
- dockerCmd(c, "run", "-d", "--net", "host", "--name", "host_container", "busybox", "top") |
|
37 |
- out, _, err := dockerCmdWithError("run", "--name", "should_fail", "--link", "host_container:tester", "busybox", "true") |
|
38 |
- if err == nil || !strings.Contains(out, "--net=host can't be used with links. This would result in undefined behavior") { |
|
39 |
- c.Fatalf("Running container linking to a container with --net host should have failed: %s", out) |
|
40 |
- } |
|
41 |
- |
|
42 |
-} |