From 3dd25b97902e064f43d56632d3a72768e36eecc5 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Mon, 19 Dec 2016 13:25:11 +0100 Subject: [PATCH] =?UTF-8?q?Global=20variable=20workingDirectory=20is=20not?= =?UTF-8?q?=20needed=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … and given where it was used, it should be quicker to create an empty folder instead of passing potentially a big context with unrelated file. Signed-off-by: Vincent Demeester --- integration-cli/docker_cli_run_test.go | 8 ++++++-- integration-cli/docker_test_vars.go | 3 --- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/integration-cli/docker_cli_run_test.go b/integration-cli/docker_cli_run_test.go index 6a7448e67e..9ace5ceda5 100644 --- a/integration-cli/docker_cli_run_test.go +++ b/integration-cli/docker_cli_run_test.go @@ -623,13 +623,14 @@ func (s *DockerSuite) TestRunCreateVolume(c *check.C) { func (s *DockerSuite) TestRunCreateVolumeWithSymlink(c *check.C) { // Cannot run on Windows as relies on Linux-specific functionality (sh -c mount...) testRequires(c, DaemonIsLinux) + workingDirectory, err := ioutil.TempDir("", "TestRunCreateVolumeWithSymlink") image := "docker-test-createvolumewithsymlink" buildCmd := exec.Command(dockerBinary, "build", "-t", image, "-") buildCmd.Stdin = strings.NewReader(`FROM busybox RUN ln -s home /bar`) buildCmd.Dir = workingDirectory - err := buildCmd.Run() + err = buildCmd.Run() if err != nil { c.Fatalf("could not build '%s': %v", image, err) } @@ -658,6 +659,9 @@ func (s *DockerSuite) TestRunVolumesFromSymlinkPath(c *check.C) { // This test cannot run on a Windows daemon as // Windows does not support symlinks inside a volume path testRequires(c, DaemonIsLinux) + + workingDirectory, err := ioutil.TempDir("", "TestRunVolumesFromSymlinkPath") + c.Assert(err, checker.IsNil) name := "docker-test-volumesfromsymlinkpath" prefix := "" dfContents := `FROM busybox @@ -676,7 +680,7 @@ func (s *DockerSuite) TestRunVolumesFromSymlinkPath(c *check.C) { buildCmd := exec.Command(dockerBinary, "build", "-t", name, "-") buildCmd.Stdin = strings.NewReader(dfContents) buildCmd.Dir = workingDirectory - err := buildCmd.Run() + err = buildCmd.Run() if err != nil { c.Fatalf("could not build 'docker-test-volumesfromsymlinkpath': %v", err) } diff --git a/integration-cli/docker_test_vars.go b/integration-cli/docker_test_vars.go index 2c457f9c9e..fa80b53c9d 100644 --- a/integration-cli/docker_test_vars.go +++ b/integration-cli/docker_test_vars.go @@ -25,8 +25,6 @@ var ( // the private registry to use for tests privateRegistryURL = "127.0.0.1:5000" - workingDirectory string - // isLocalDaemon is true if the daemon under test is on the same // host as the CLI. isLocalDaemon bool @@ -84,7 +82,6 @@ func init() { if registry := os.Getenv("REGISTRY_URL"); registry != "" { privateRegistryURL = registry } - workingDirectory, _ = os.Getwd() // Deterministically working out the environment in which CI is running // to evaluate whether the daemon is local or remote is not possible through