mirror of https://github.com/docker/compose.git
Changing e2e test PATH to make windows tests pass
Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
parent
d320d5460c
commit
17bda79ca1
|
@ -295,7 +295,7 @@ func TestLegacy(t *testing.T) {
|
|||
|
||||
t.Run("run without HOME defined", func(t *testing.T) {
|
||||
cmd := c.NewDockerCmd("ps")
|
||||
cmd.Env = []string{"PATH=" + c.BinDir}
|
||||
cmd.Env = []string{"PATH=" + c.PathEnvVar()}
|
||||
res := icmd.RunCmd(cmd)
|
||||
res.Assert(t, icmd.Expected{
|
||||
ExitCode: 0,
|
||||
|
@ -306,7 +306,7 @@ func TestLegacy(t *testing.T) {
|
|||
|
||||
t.Run("run without write access to context store", func(t *testing.T) {
|
||||
cmd := c.NewDockerCmd("ps")
|
||||
cmd.Env = []string{"PATH=" + c.BinDir, "HOME=/doesnotexist/"}
|
||||
cmd.Env = []string{"PATH=" + c.PathEnvVar(), "HOME=/doesnotexist/"}
|
||||
res := icmd.RunCmd(cmd)
|
||||
res.Assert(t, icmd.Expected{
|
||||
ExitCode: 0,
|
||||
|
|
|
@ -143,14 +143,10 @@ func CopyFile(sourceFile string, destinationFile string) error {
|
|||
|
||||
// NewCmd creates a cmd object configured with the test environment set
|
||||
func (c *E2eCLI) NewCmd(command string, args ...string) icmd.Cmd {
|
||||
path := c.BinDir + ":" + os.Getenv("PATH")
|
||||
if runtime.GOOS == "windows" {
|
||||
path = c.BinDir + ";" + os.Getenv("PATH")
|
||||
}
|
||||
env := append(os.Environ(),
|
||||
"DOCKER_CONFIG="+c.ConfigDir,
|
||||
"KUBECONFIG=invalid",
|
||||
"PATH="+path,
|
||||
"PATH="+c.PathEnvVar(),
|
||||
)
|
||||
return icmd.Cmd{
|
||||
Command: append([]string{command}, args...),
|
||||
|
@ -176,6 +172,15 @@ func (c *E2eCLI) RunDockerCmd(args ...string) *icmd.Result {
|
|||
return res
|
||||
}
|
||||
|
||||
// PathEnvVar returns path (os sensitive) for running test
|
||||
func (c *E2eCLI) PathEnvVar() string {
|
||||
path := c.BinDir + ":" + os.Getenv("PATH")
|
||||
if runtime.GOOS == "windows" {
|
||||
path = c.BinDir + ";" + os.Getenv("PATH")
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
// GoldenFile golden file specific to platform
|
||||
func GoldenFile(name string) string {
|
||||
if runtime.GOOS == "windows" {
|
||||
|
|
Loading…
Reference in New Issue