Global variable workingDirectory is not needed…

… 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 <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester 2016-12-19 13:25:11 +01:00
parent 48f7388e92
commit 3dd25b9790
No known key found for this signature in database
GPG Key ID: 083CC6FD6EB699A3
2 changed files with 6 additions and 5 deletions

View File

@ -623,13 +623,14 @@ func (s *DockerSuite) TestRunCreateVolume(c *check.C) {
func (s *DockerSuite) TestRunCreateVolumeWithSymlink(c *check.C) { func (s *DockerSuite) TestRunCreateVolumeWithSymlink(c *check.C) {
// Cannot run on Windows as relies on Linux-specific functionality (sh -c mount...) // Cannot run on Windows as relies on Linux-specific functionality (sh -c mount...)
testRequires(c, DaemonIsLinux) testRequires(c, DaemonIsLinux)
workingDirectory, err := ioutil.TempDir("", "TestRunCreateVolumeWithSymlink")
image := "docker-test-createvolumewithsymlink" image := "docker-test-createvolumewithsymlink"
buildCmd := exec.Command(dockerBinary, "build", "-t", image, "-") buildCmd := exec.Command(dockerBinary, "build", "-t", image, "-")
buildCmd.Stdin = strings.NewReader(`FROM busybox buildCmd.Stdin = strings.NewReader(`FROM busybox
RUN ln -s home /bar`) RUN ln -s home /bar`)
buildCmd.Dir = workingDirectory buildCmd.Dir = workingDirectory
err := buildCmd.Run() err = buildCmd.Run()
if err != nil { if err != nil {
c.Fatalf("could not build '%s': %v", image, err) 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 // This test cannot run on a Windows daemon as
// Windows does not support symlinks inside a volume path // Windows does not support symlinks inside a volume path
testRequires(c, DaemonIsLinux) testRequires(c, DaemonIsLinux)
workingDirectory, err := ioutil.TempDir("", "TestRunVolumesFromSymlinkPath")
c.Assert(err, checker.IsNil)
name := "docker-test-volumesfromsymlinkpath" name := "docker-test-volumesfromsymlinkpath"
prefix := "" prefix := ""
dfContents := `FROM busybox dfContents := `FROM busybox
@ -676,7 +680,7 @@ func (s *DockerSuite) TestRunVolumesFromSymlinkPath(c *check.C) {
buildCmd := exec.Command(dockerBinary, "build", "-t", name, "-") buildCmd := exec.Command(dockerBinary, "build", "-t", name, "-")
buildCmd.Stdin = strings.NewReader(dfContents) buildCmd.Stdin = strings.NewReader(dfContents)
buildCmd.Dir = workingDirectory buildCmd.Dir = workingDirectory
err := buildCmd.Run() err = buildCmd.Run()
if err != nil { if err != nil {
c.Fatalf("could not build 'docker-test-volumesfromsymlinkpath': %v", err) c.Fatalf("could not build 'docker-test-volumesfromsymlinkpath': %v", err)
} }

View File

@ -25,8 +25,6 @@ var (
// the private registry to use for tests // the private registry to use for tests
privateRegistryURL = "127.0.0.1:5000" privateRegistryURL = "127.0.0.1:5000"
workingDirectory string
// isLocalDaemon is true if the daemon under test is on the same // isLocalDaemon is true if the daemon under test is on the same
// host as the CLI. // host as the CLI.
isLocalDaemon bool isLocalDaemon bool
@ -84,7 +82,6 @@ func init() {
if registry := os.Getenv("REGISTRY_URL"); registry != "" { if registry := os.Getenv("REGISTRY_URL"); registry != "" {
privateRegistryURL = registry privateRegistryURL = registry
} }
workingDirectory, _ = os.Getwd()
// Deterministically working out the environment in which CI is running // Deterministically working out the environment in which CI is running
// to evaluate whether the daemon is local or remote is not possible through // to evaluate whether the daemon is local or remote is not possible through