浏览代码

one more windows adaptation

Signed-off-by: guillaume.tardif <[email protected]>
guillaume.tardif 4 年之前
父节点
当前提交
df7f57e227
共有 1 个文件被更改,包括 15 次插入4 次删除
  1. 15 4
      local/e2e/compose/compose_test.go

+ 15 - 4
local/e2e/compose/compose_test.go

@@ -23,6 +23,7 @@ import (
 	"os"
 	"path/filepath"
 	"regexp"
+	"runtime"
 	"strings"
 	"testing"
 	"time"
@@ -132,21 +133,31 @@ func TestLocalComposeUp(t *testing.T) {
 	})
 }
 
+func binExt() string {
+	binaryExt := ""
+	if runtime.GOOS == "windows" {
+		binaryExt = ".exe"
+	}
+	return binaryExt
+}
 func TestComposeUsingCliPlugin(t *testing.T) {
 	c := NewParallelE2eCLI(t, binDir)
 
-	err := os.Remove(filepath.Join(c.ConfigDir, "cli-plugins", "docker-compose"))
+	err := os.Remove(filepath.Join(c.ConfigDir, "cli-plugins", "docker-compose"+binExt()))
 	assert.NilError(t, err)
 	res := c.RunDockerOrExitError("compose", "ls")
 	res.Assert(t, icmd.Expected{Err: "'compose' is not a docker command", ExitCode: 1})
 }
 
 func TestComposeCliPluginWithoutCloudIntegration(t *testing.T) {
-	c := NewParallelE2eCLI(t, binDir)
+	newBinFolder, cleanup, err := SetupExistingCLI() // do not share bin folder with other tests
+	assert.NilError(t, err)
+	defer cleanup()
+	c := NewParallelE2eCLI(t, newBinFolder)
 
-	err := os.Remove(filepath.Join(binDir, "docker"))
+	err = os.Remove(filepath.Join(newBinFolder, "docker"+binExt()))
 	assert.NilError(t, err)
-	err = os.Rename(filepath.Join(binDir, "com.docker.cli"), filepath.Join(binDir, "docker"))
+	err = os.Rename(filepath.Join(newBinFolder, "com.docker.cli"+binExt()), filepath.Join(newBinFolder, "docker"+binExt()))
 	assert.NilError(t, err)
 	res := c.RunDockerOrExitError("compose", "ls")
 	res.Assert(t, icmd.Expected{Out: "NAME                STATUS", ExitCode: 0})