Skip to content

Commit

Permalink
test: e2e test reliability improvements (#10950)
Browse files Browse the repository at this point in the history
* Use unique project name prefixes (some of these tests assert
  on output using the project name as a magic string, so could
  be impacted by other tests with the same project name prefix)
* Tear down port range project before starting to try and avoid
  race conditions with the engine and port assignment

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
  • Loading branch information
milas committed Aug 30, 2023
1 parent 4fbbf20 commit d6f842b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions pkg/e2e/compose_up_test.go
Expand Up @@ -71,10 +71,14 @@ func TestPortRange(t *testing.T) {
c := NewParallelCLI(t)
const projectName = "e2e-port-range"

reset := func() {
c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--remove-orphans", "--timeout=0")
}
reset()
t.Cleanup(reset)

res := c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/port-range/compose.yaml", "--project-name", projectName, "up", "-d")
res.Assert(t, icmd.Success)

c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--remove-orphans")
}

func TestStdoutStderr(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/e2e/profiles_test.go
Expand Up @@ -31,7 +31,7 @@ const (

func TestExplicitProfileUsage(t *testing.T) {
c := NewParallelCLI(t)
const projectName = "compose-e2e-profiles"
const projectName = "compose-e2e-explicit-profiles"
const profileName = "test-profile"

t.Run("compose up with profile", func(t *testing.T) {
Expand Down Expand Up @@ -132,7 +132,7 @@ func TestNoProfileUsage(t *testing.T) {

func TestActiveProfileViaTargetedService(t *testing.T) {
c := NewParallelCLI(t)
const projectName = "compose-e2e-profiles-via-target-service"
const projectName = "compose-e2e-via-target-service-profiles"
const profileName = "test-profile"

t.Run("compose up with service name", func(t *testing.T) {
Expand Down

0 comments on commit d6f842b

Please sign in to comment.