Skip to content

Commit b53b8b2

Browse files
authored
Merge pull request #11739 from milas/fix-e2e-cascade-flaky
chore(e2e): fix flaky cascade failure test
2 parents 299fcd5 + 36bf0c4 commit b53b8b2

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

pkg/e2e/cascade_test.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ func TestCascadeStop(t *testing.T) {
3636
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/cascade/compose.yaml", "--project-name", projectName,
3737
"up", "--abort-on-container-exit")
3838
assert.Assert(t, strings.Contains(res.Combined(), "exit-1 exited with code 0"), res.Combined())
39+
// no --exit-code-from, so this is not an error
40+
assert.Equal(t, res.ExitCode, 0)
3941
}
4042

4143
func TestCascadeFail(t *testing.T) {
@@ -48,6 +50,7 @@ func TestCascadeFail(t *testing.T) {
4850
res := c.RunDockerComposeCmdNoCheck(t, "-f", "./fixtures/cascade/compose.yaml", "--project-name", projectName,
4951
"up", "--abort-on-container-failure")
5052
assert.Assert(t, strings.Contains(res.Combined(), "exit-1 exited with code 0"), res.Combined())
51-
assert.Assert(t, strings.Contains(res.Combined(), "fail-1 exited with code 1"), res.Combined())
52-
assert.Equal(t, res.ExitCode, 1)
53+
assert.Assert(t, strings.Contains(res.Combined(), "fail-1 exited with code 111"), res.Combined())
54+
// failing exit code should be propagated
55+
assert.Equal(t, res.ExitCode, 111)
5356
}

pkg/e2e/fixtures/cascade/compose.yaml

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
services:
2+
running:
3+
image: alpine
4+
command: sleep infinity
5+
init: true
6+
27
exit:
38
image: alpine
49
command: /bin/true
10+
depends_on:
11+
running:
12+
condition: service_started
513

614
fail:
715
image: alpine
8-
command: sh -c "sleep 0.1 && /bin/false"
16+
command: sh -c "return 111"
17+
depends_on:
18+
exit:
19+
condition: service_completed_successfully

0 commit comments

Comments
 (0)