|  | @@ -31,31 +31,30 @@ import (
 | 
	
		
			
				|  |  |  	"gotest.tools/v3/icmd"
 | 
	
		
			
				|  |  |  )
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -var binDir string
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  func TestLocalComposeUp(t *testing.T) {
 | 
	
		
			
				|  |  | -	c := NewParallelE2eCLI(t, binDir)
 | 
	
		
			
				|  |  | +	// this test shares a fixture with TestCompatibility and can't run at the same time
 | 
	
		
			
				|  |  | +	c := NewCLI(t)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	const projectName = "compose-e2e-demo"
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("up", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		c.RunDockerComposeCmd("-f", "./fixtures/sentences/compose.yaml", "--project-name", projectName, "up", "-d")
 | 
	
		
			
				|  |  | +		c.RunDockerComposeCmd(t, "-f", "./fixtures/sentences/compose.yaml", "--project-name", projectName, "up", "-d")
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("check accessing running app", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		res := c.RunDockerComposeCmd("-p", projectName, "ps")
 | 
	
		
			
				|  |  | +		res := c.RunDockerComposeCmd(t, "-p", projectName, "ps")
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: `web`})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		endpoint := "http://localhost:90"
 | 
	
		
			
				|  |  |  		output := HTTPGetWithRetry(t, endpoint+"/words/noun", http.StatusOK, 2*time.Second, 20*time.Second)
 | 
	
		
			
				|  |  |  		assert.Assert(t, strings.Contains(output, `"word":`))
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -		res = c.RunDockerCmd("network", "ls")
 | 
	
		
			
				|  |  | +		res = c.RunDockerCmd(t, "network", "ls")
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: projectName + "_default"})
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("top", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		res := c.RunDockerComposeCmd("-p", projectName, "top")
 | 
	
		
			
				|  |  | +		res := c.RunDockerComposeCmd(t, "-p", projectName, "top")
 | 
	
		
			
				|  |  |  		output := res.Stdout()
 | 
	
		
			
				|  |  |  		head := []string{"UID", "PID", "PPID", "C", "STIME", "TTY", "TIME", "CMD"}
 | 
	
		
			
				|  |  |  		for _, h := range head {
 | 
	
	
		
			
				|  | @@ -66,7 +65,7 @@ func TestLocalComposeUp(t *testing.T) {
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("check compose labels", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		res := c.RunDockerCmd("inspect", projectName+"-web-1")
 | 
	
		
			
				|  |  | +		res := c.RunDockerCmd(t, "inspect", projectName+"-web-1")
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: `"com.docker.compose.container-number": "1"`})
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: `"com.docker.compose.project": "compose-e2e-demo"`})
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: `"com.docker.compose.oneoff": "False",`})
 | 
	
	
		
			
				|  | @@ -76,55 +75,55 @@ func TestLocalComposeUp(t *testing.T) {
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: `"com.docker.compose.service": "web"`})
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: `"com.docker.compose.version":`})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -		res = c.RunDockerCmd("network", "inspect", projectName+"_default")
 | 
	
		
			
				|  |  | +		res = c.RunDockerCmd(t, "network", "inspect", projectName+"_default")
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: `"com.docker.compose.network": "default"`})
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: `"com.docker.compose.project": `})
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: `"com.docker.compose.version": `})
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("check user labels", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		res := c.RunDockerCmd("inspect", projectName+"-web-1")
 | 
	
		
			
				|  |  | +		res := c.RunDockerCmd(t, "inspect", projectName+"-web-1")
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: `"my-label": "test"`})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("check healthcheck output", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		c.WaitForCmdResult(c.NewDockerCmd("compose", "-p", projectName, "ps", "--format", "json"),
 | 
	
		
			
				|  |  | +		c.WaitForCmdResult(t, c.NewDockerCmd("compose", "-p", projectName, "ps", "--format", "json"),
 | 
	
		
			
				|  |  |  			StdoutContains(`"Name":"compose-e2e-demo-web-1","Command":"/dispatcher","Project":"compose-e2e-demo","Service":"web","State":"running","Health":"healthy"`),
 | 
	
		
			
				|  |  |  			5*time.Second, 1*time.Second)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -		res := c.RunDockerComposeCmd("-p", projectName, "ps")
 | 
	
		
			
				|  |  | +		res := c.RunDockerComposeCmd(t, "-p", projectName, "ps")
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: `NAME                       COMMAND                  SERVICE             STATUS              PORTS`})
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: `compose-e2e-demo-web-1     "/dispatcher"            web                 running (healthy)   0.0.0.0:90->80/tcp`})
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: `compose-e2e-demo-db-1      "docker-entrypoint.s…"   db                  running             5432/tcp`})
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("images", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		res := c.RunDockerComposeCmd("-p", projectName, "images")
 | 
	
		
			
				|  |  | +		res := c.RunDockerComposeCmd(t, "-p", projectName, "images")
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: `compose-e2e-demo-db-1      gtardif/sentences-db    latest`})
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: `compose-e2e-demo-web-1     gtardif/sentences-web   latest`})
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: `compose-e2e-demo-words-1   gtardif/sentences-api   latest`})
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("down", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		_ = c.RunDockerComposeCmd("--project-name", projectName, "down")
 | 
	
		
			
				|  |  | +		_ = c.RunDockerComposeCmd(t, "--project-name", projectName, "down")
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("check containers after down", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		res := c.RunDockerCmd("ps", "--all")
 | 
	
		
			
				|  |  | +		res := c.RunDockerCmd(t, "ps", "--all")
 | 
	
		
			
				|  |  |  		assert.Assert(t, !strings.Contains(res.Combined(), projectName), res.Combined())
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("check networks after down", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		res := c.RunDockerCmd("network", "ls")
 | 
	
		
			
				|  |  | +		res := c.RunDockerCmd(t, "network", "ls")
 | 
	
		
			
				|  |  |  		assert.Assert(t, !strings.Contains(res.Combined(), projectName), res.Combined())
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  func TestComposePull(t *testing.T) {
 | 
	
		
			
				|  |  | -	c := NewParallelE2eCLI(t, binDir)
 | 
	
		
			
				|  |  | +	c := NewParallelCLI(t)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	res := c.RunDockerOrExitError("compose", "--project-directory", "fixtures/simple-composefile", "pull")
 | 
	
		
			
				|  |  | +	res := c.RunDockerOrExitError(t, "compose", "--project-directory", "fixtures/simple-composefile", "pull")
 | 
	
		
			
				|  |  |  	output := res.Combined()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	assert.Assert(t, strings.Contains(output, "simple Pulled"))
 | 
	
	
		
			
				|  | @@ -132,102 +131,108 @@ func TestComposePull(t *testing.T) {
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  func TestDownComposefileInParentFolder(t *testing.T) {
 | 
	
		
			
				|  |  | -	c := NewParallelE2eCLI(t, binDir)
 | 
	
		
			
				|  |  | +	c := NewParallelCLI(t)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	tmpFolder, err := ioutil.TempDir("fixtures/simple-composefile", "test-tmp")
 | 
	
		
			
				|  |  |  	assert.NilError(t, err)
 | 
	
		
			
				|  |  |  	defer os.Remove(tmpFolder) // nolint: errcheck
 | 
	
		
			
				|  |  |  	projectName := filepath.Base(tmpFolder)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	res := c.RunDockerComposeCmd("--project-directory", tmpFolder, "up", "-d")
 | 
	
		
			
				|  |  | +	res := c.RunDockerComposeCmd(t, "--project-directory", tmpFolder, "up", "-d")
 | 
	
		
			
				|  |  |  	res.Assert(t, icmd.Expected{Err: "Started", ExitCode: 0})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	res = c.RunDockerComposeCmd("-p", projectName, "down")
 | 
	
		
			
				|  |  | +	res = c.RunDockerComposeCmd(t, "-p", projectName, "down")
 | 
	
		
			
				|  |  |  	res.Assert(t, icmd.Expected{Err: "Removed", ExitCode: 0})
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  func TestAttachRestart(t *testing.T) {
 | 
	
		
			
				|  |  | -	c := NewParallelE2eCLI(t, binDir)
 | 
	
		
			
				|  |  | +	c := NewParallelCLI(t)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	cmd := c.NewDockerCmd("compose", "--ansi=never", "--project-directory", "./fixtures/attach-restart", "up")
 | 
	
		
			
				|  |  |  	res := icmd.StartCmd(cmd)
 | 
	
		
			
				|  |  | -	defer c.RunDockerOrExitError("compose", "-p", "attach-restart", "down")
 | 
	
		
			
				|  |  | +	defer c.RunDockerOrExitError(t, "compose", "-p", "attach-restart", "down")
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	c.WaitForCondition(func() (bool, string) {
 | 
	
		
			
				|  |  | +	c.WaitForCondition(t, func() (bool, string) {
 | 
	
		
			
				|  |  |  		debug := res.Combined()
 | 
	
		
			
				|  |  | -		return strings.Count(res.Stdout(), "failing-1 exited with code 1") == 3, fmt.Sprintf("'failing-1 exited with code 1' not found 3 times in : \n%s\n", debug)
 | 
	
		
			
				|  |  | +		return strings.Count(res.Stdout(),
 | 
	
		
			
				|  |  | +				"failing-1 exited with code 1") == 3, fmt.Sprintf("'failing-1 exited with code 1' not found 3 times in : \n%s\n",
 | 
	
		
			
				|  |  | +				debug)
 | 
	
		
			
				|  |  |  	}, 2*time.Minute, 2*time.Second)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	assert.Equal(t, strings.Count(res.Stdout(), "failing-1  | world"), 3, res.Combined())
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  func TestInitContainer(t *testing.T) {
 | 
	
		
			
				|  |  | -	c := NewParallelE2eCLI(t, binDir)
 | 
	
		
			
				|  |  | +	c := NewParallelCLI(t)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	res := c.RunDockerOrExitError("compose", "--ansi=never", "--project-directory", "./fixtures/init-container", "up")
 | 
	
		
			
				|  |  | -	defer c.RunDockerOrExitError("compose", "-p", "init-container", "down")
 | 
	
		
			
				|  |  | +	res := c.RunDockerOrExitError(t, "compose", "--ansi=never", "--project-directory", "./fixtures/init-container", "up")
 | 
	
		
			
				|  |  | +	defer c.RunDockerOrExitError(t, "compose", "-p", "init-container", "down")
 | 
	
		
			
				|  |  |  	testify.Regexp(t, "foo-1  | hello(?m:.*)bar-1  | world", res.Stdout())
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  func TestRm(t *testing.T) {
 | 
	
		
			
				|  |  | -	c := NewParallelE2eCLI(t, binDir)
 | 
	
		
			
				|  |  | +	c := NewParallelCLI(t)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	const projectName = "compose-e2e-rm"
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("up", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		c.RunDockerComposeCmd("-f", "./fixtures/simple-composefile/compose.yaml", "-p", projectName, "up", "-d")
 | 
	
		
			
				|  |  | +		c.RunDockerComposeCmd(t, "-f", "./fixtures/simple-composefile/compose.yaml", "-p", projectName, "up", "-d")
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("rm -sf", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		res := c.RunDockerComposeCmd("-f", "./fixtures/simple-composefile/compose.yaml", "-p", projectName, "rm", "-sf", "simple")
 | 
	
		
			
				|  |  | +		res := c.RunDockerComposeCmd(t, "-f", "./fixtures/simple-composefile/compose.yaml", "-p", projectName, "rm",
 | 
	
		
			
				|  |  | +			"-sf", "simple")
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Err: "Removed", ExitCode: 0})
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("check containers after rm -sf", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		res := c.RunDockerCmd("ps", "--all")
 | 
	
		
			
				|  |  | +		res := c.RunDockerCmd(t, "ps", "--all")
 | 
	
		
			
				|  |  |  		assert.Assert(t, !strings.Contains(res.Combined(), projectName+"_simple"), res.Combined())
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("rm -sf <none>", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		res := c.RunDockerComposeCmd("-f", "./fixtures/simple-composefile/compose.yaml", "-p", projectName, "rm", "-sf", "simple")
 | 
	
		
			
				|  |  | +		res := c.RunDockerComposeCmd(t, "-f", "./fixtures/simple-composefile/compose.yaml", "-p", projectName, "rm",
 | 
	
		
			
				|  |  | +			"-sf", "simple")
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{ExitCode: 0})
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("down", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		c.RunDockerComposeCmd("-p", projectName, "down")
 | 
	
		
			
				|  |  | +		c.RunDockerComposeCmd(t, "-p", projectName, "down")
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  func TestCompatibility(t *testing.T) {
 | 
	
		
			
				|  |  | -	c := NewParallelE2eCLI(t, binDir)
 | 
	
		
			
				|  |  | +	// this test shares a fixture with TestLocalComposeUp and can't run at the same time
 | 
	
		
			
				|  |  | +	c := NewCLI(t)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	const projectName = "compose-e2e-compatibility"
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("up", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		c.RunDockerComposeCmd("--compatibility", "-f", "./fixtures/sentences/compose.yaml", "--project-name", projectName, "up", "-d")
 | 
	
		
			
				|  |  | +		c.RunDockerComposeCmd(t, "--compatibility", "-f", "./fixtures/sentences/compose.yaml", "--project-name",
 | 
	
		
			
				|  |  | +			projectName, "up", "-d")
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("check container names", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		res := c.RunDockerCmd("ps", "--format", "{{.Names}}")
 | 
	
		
			
				|  |  | +		res := c.RunDockerCmd(t, "ps", "--format", "{{.Names}}")
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: "compose-e2e-compatibility_web_1"})
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: "compose-e2e-compatibility_words_1"})
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: "compose-e2e-compatibility_db_1"})
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("down", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		c.RunDockerComposeCmd("-p", projectName, "down")
 | 
	
		
			
				|  |  | +		c.RunDockerComposeCmd(t, "-p", projectName, "down")
 | 
	
		
			
				|  |  |  	})
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  func TestConvert(t *testing.T) {
 | 
	
		
			
				|  |  |  	const projectName = "compose-e2e-convert"
 | 
	
		
			
				|  |  | -	c := NewParallelE2eCLI(t, binDir)
 | 
	
		
			
				|  |  | +	c := NewParallelCLI(t)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	wd, err := os.Getwd()
 | 
	
		
			
				|  |  |  	assert.NilError(t, err)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	t.Run("up", func(t *testing.T) {
 | 
	
		
			
				|  |  | -		res := c.RunDockerComposeCmd("-f", "./fixtures/simple-build-test/compose.yaml", "-p", projectName, "convert")
 | 
	
		
			
				|  |  | +		res := c.RunDockerComposeCmd(t, "-f", "./fixtures/simple-build-test/compose.yaml", "-p", projectName, "convert")
 | 
	
		
			
				|  |  |  		res.Assert(t, icmd.Expected{Out: fmt.Sprintf(`services:
 | 
	
		
			
				|  |  |    nginx:
 | 
	
		
			
				|  |  |      build:
 |