Skip to content

Commit

Permalink
logic refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
nialdaly committed Jun 20, 2022
1 parent ffe6365 commit 87ab7bd
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions modules/docker/docker_compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,7 @@ func RunDockerComposeE(t testing.TestingT, options *Options, args ...string) (st
}

func runDockerComposeE(t testing.TestingT, stdout bool, options *Options, args ...string) (string, error) {
cmd := shell.Command{
Command: "docker-compose",
// We append --project-name to ensure containers from multiple different tests using Docker Compose don't end
// up in the same project and end up conflicting with each other.
Args: append([]string{"--project-name", strings.ToLower(t.Name())}, args...),
WorkingDir: options.WorkingDir,
Env: options.EnvVars,
Logger: options.Logger,
}
var cmd shell.Command

dockerComposeVersionCmd := icmd.Command("docker", "compose", "version")

Expand All @@ -62,6 +54,16 @@ func runDockerComposeE(t testing.TestingT, stdout bool, options *Options, args .
Env: options.EnvVars,
Logger: options.Logger,
}
} else {
cmd = shell.Command{
Command: "docker-compose",
// We append --project-name to ensure containers from multiple different tests using Docker Compose don't end
// up in the same project and end up conflicting with each other.
Args: append([]string{"--project-name", strings.ToLower(t.Name())}, args...),
WorkingDir: options.WorkingDir,
Env: options.EnvVars,
Logger: options.Logger,
}
}

if stdout {
Expand Down

0 comments on commit 87ab7bd

Please sign in to comment.