Skip to content

Commit d6f842b

Browse files
authored
test: e2e test reliability improvements (docker#10950)
* 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 <[email protected]>
1 parent 4fbbf20 commit d6f842b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

pkg/e2e/compose_up_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,14 @@ func TestPortRange(t *testing.T) {
7171
c := NewParallelCLI(t)
7272
const projectName = "e2e-port-range"
7373

74+
reset := func() {
75+
c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--remove-orphans", "--timeout=0")
76+
}
77+
reset()
78+
t.Cleanup(reset)
79+
7480
res := c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/port-range/compose.yaml", "--project-name", projectName, "up", "-d")
7581
res.Assert(t, icmd.Success)
76-
77-
c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--remove-orphans")
7882
}
7983

8084
func TestStdoutStderr(t *testing.T) {

pkg/e2e/profiles_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const (
3131

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

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

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

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

0 commit comments

Comments
 (0)