|
@@ -15,7 +15,6 @@ import (
|
|
)
|
|
)
|
|
|
|
|
|
func (s *DockerSuite) TestLinksEtcHostsRegularFile(c *check.C) {
|
|
func (s *DockerSuite) TestLinksEtcHostsRegularFile(c *check.C) {
|
|
-
|
|
|
|
runCmd := exec.Command(dockerBinary, "run", "--net=host", "busybox", "ls", "-la", "/etc/hosts")
|
|
runCmd := exec.Command(dockerBinary, "run", "--net=host", "busybox", "ls", "-la", "/etc/hosts")
|
|
out, _, _, err := runCommandWithStdoutStderr(runCmd)
|
|
out, _, _, err := runCommandWithStdoutStderr(runCmd)
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -331,3 +330,23 @@ func (s *DockerSuite) TestLinksEnvs(c *check.C) {
|
|
c.Fatalf("Incorrect output: %s", out)
|
|
c.Fatalf("Incorrect output: %s", out)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+func (s *DockerSuite) TestLinkShortDefinition(c *check.C) {
|
|
|
|
+ runCmd := exec.Command(dockerBinary, "run", "-d", "--name", "shortlinkdef", "busybox", "top")
|
|
|
|
+ out, _, err := runCommandWithOutput(runCmd)
|
|
|
|
+ c.Assert(err, check.IsNil)
|
|
|
|
+
|
|
|
|
+ cid := strings.TrimSpace(out)
|
|
|
|
+ c.Assert(waitRun(cid), check.IsNil)
|
|
|
|
+
|
|
|
|
+ runCmd = exec.Command(dockerBinary, "run", "-d", "--name", "link2", "--link", "shortlinkdef", "busybox", "top")
|
|
|
|
+ out, _, err = runCommandWithOutput(runCmd)
|
|
|
|
+ c.Assert(err, check.IsNil)
|
|
|
|
+
|
|
|
|
+ cid2 := strings.TrimSpace(out)
|
|
|
|
+ c.Assert(waitRun(cid2), check.IsNil)
|
|
|
|
+
|
|
|
|
+ links, err := inspectFieldJSON(cid2, "HostConfig.Links")
|
|
|
|
+ c.Assert(err, check.IsNil)
|
|
|
|
+ c.Assert(links, check.Equals, "[\"/shortlinkdef:/link2/shortlinkdef\"]")
|
|
|
|
+}
|