From d0dc14e5d6fe5f8ef9d4a8a8dc95fa087439a5b4 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Tue, 17 Feb 2015 23:20:20 -0800 Subject: [PATCH] integ-cli: Fix TestBuildAddBadLinks for windows TestBuildAddBadLinks used to build a path by concenating unix-style forward slashes. Fixed that by providing a windows-equivalent using `runtime.GOOS`. Signed-off-by: Ahmet Alp Balkan --- integration-cli/docker_cli_build_test.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/integration-cli/docker_cli_build_test.go b/integration-cli/docker_cli_build_test.go index 14c9835bf8..dd0b10f6a3 100644 --- a/integration-cli/docker_cli_build_test.go +++ b/integration-cli/docker_cli_build_test.go @@ -12,6 +12,7 @@ import ( "path/filepath" "reflect" "regexp" + "runtime" "strconv" "strings" "syscall" @@ -1568,7 +1569,21 @@ func TestBuildAddBadLinks(t *testing.T) { } defer os.RemoveAll(tempDir) - symlinkTarget := fmt.Sprintf("/../../../../../../../../../../../..%s", tempDir) + var symlinkTarget string + if runtime.GOOS == "windows" { + var driveLetter string + if abs, err := filepath.Abs(tempDir); err != nil { + t.Fatal(err) + } else { + driveLetter = abs[:1] + } + tempDirWithoutDrive := tempDir[2:] + symlinkTarget = fmt.Sprintf(`%s:\..\..\..\..\..\..\..\..\..\..\..\..%s`, driveLetter, tempDirWithoutDrive) + } else { + symlinkTarget = fmt.Sprintf("/../../../../../../../../../../../..%s", tempDir) + } + + t.Logf("***=== %s", symlinkTarget) tarPath := filepath.Join(ctx.Dir, "links.tar") nonExistingFile := filepath.Join(tempDir, targetFile) fooPath := filepath.Join(ctx.Dir, targetFile)