From c11bcbefdee2cf186cf1bf2f5c0b03240554a4ce Mon Sep 17 00:00:00 2001 From: John Howard Date: Thu, 28 Jan 2016 14:52:34 -0800 Subject: [PATCH] Fix TestRunCreateVolumesInSymlinkDir Signed-off-by: John Howard Upstream-commit: 90b0292b5b06c5e71d47e5dee34d3d4744682506 Component: engine --- .../integration-cli/docker_cli_run_test.go | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/components/engine/integration-cli/docker_cli_run_test.go b/components/engine/integration-cli/docker_cli_run_test.go index fe25be56a0..e67253c56a 100644 --- a/components/engine/integration-cli/docker_cli_run_test.go +++ b/components/engine/integration-cli/docker_cli_run_test.go @@ -361,6 +361,13 @@ func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir(c *check.C) { } defer os.RemoveAll(dir) + // In the case of Windows to Windows CI, if the machine is setup so that + // the temp directory is not the C: drive, this test is invalid and will + // not work. + if daemonPlatform == "windows" && strings.ToLower(dir[:1]) != "c" { + c.Skip("Requires TEMP to point to C: drive") + } + f, err := os.OpenFile(filepath.Join(dir, "test"), os.O_CREATE, 0700) if err != nil { c.Fatal(err) @@ -383,6 +390,32 @@ func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir(c *check.C) { dockerCmd(c, "run", "-v", containerPath, name, cmd) } +// Volume path is a symlink in the container +func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir2(c *check.C) { + var ( + dockerFile string + containerPath string + cmd string + ) + testRequires(c, SameHostDaemon) + name := "test-volume-symlink2" + + if daemonPlatform == "windows" { + dockerFile = fmt.Sprintf("FROM %s\nRUN mkdir c:\\%s\nRUN mklink /D c:\\test c:\\%s", WindowsBaseImage, name, name) + containerPath = `c:\test\test` + cmd = "tasklist" + } else { + dockerFile = fmt.Sprintf("FROM busybox\nRUN mkdir -p /%s\nRUN ln -s /%s /test", name, name) + containerPath = "/test/test" + cmd = "true" + } + if _, err := buildImage(name, dockerFile, false); err != nil { + c.Fatal(err) + } + + dockerCmd(c, "run", "-v", containerPath, name, cmd) +} + func (s *DockerSuite) TestRunVolumesMountedAsReadonly(c *check.C) { // TODO Windows (Post TP4): This test cannot run on a Windows daemon as // Windows does not support read-only bind mounts.