Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(e2e): fix flaky cascade failure test #11739

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

milas
Copy link
Contributor

@milas milas commented Apr 17, 2024

What I did
This was racy with the sleep, so the Compose file has been tweaked to make it pass reliably.

Now, there's 3 services:

  • running - sleeps forever
  • exit - exits successfully immediately
    • depends on running started
  • fail - exits with error immediately
    • depends on exit succeeding

Now, the test can ensure that the containers are all run/ started in the expected order the assertions will be reliable.

Before, it was possible for fail to run & exit before exit, for example. The running service also ensures there's always at least one other "running" container when we do an abort.

Related issue
n/a, just my failing CI jobs

(not mandatory) A picture of a cute animal, if possible in relation to what you did
baby cheetah

@milas milas requested a review from a team April 17, 2024 15:07
@milas milas self-assigned this Apr 17, 2024
@milas milas requested review from ndeloof, glours and jhrotko and removed request for a team April 17, 2024 15:07
@milas
Copy link
Contributor Author

milas commented Apr 17, 2024

cascade_test.go:50: Running command: /home/runner/work/compose/compose/bin/build/docker-compose -f ./fixtures/cascade/compose.yaml --project-name compose-e2e-cascade-fail up --abort-on-container-failure
Attaching to exit-1, fail-1, running-1
exit-1 exited with code 0
fail-1 exited with code 111
    cascade_test.go:55: assertion failed: 143 (res.ExitCode int) != 111 (int)

🤔

Copy link
Contributor

@jhrotko jhrotko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jhrotko
Copy link
Contributor

jhrotko commented Apr 18, 2024

cascade_test.go:50: Running command: /home/runner/work/compose/compose/bin/build/docker-compose -f ./fixtures/cascade/compose.yaml --project-name compose-e2e-cascade-fail up --abort-on-container-failure
Attaching to exit-1, fail-1, running-1
exit-1 exited with code 0
fail-1 exited with code 111
    cascade_test.go:55: assertion failed: 143 (res.ExitCode int) != 111 (int)

🤔

Screenshot 2024-04-18 at 16 59 01 🤔

This was racy with the sleep, so the Compose file has been
tweaked to make it pass reliably.

Now, there's 3 services:
 * `running` - sleeps forever
 * `exit` - exits _successfully_ immediately
   * depends on `running` started
 * `fail` - exits _with error_ immediately
   * depends on `exit` succeeding

Now, the test can ensure that the containers are all run/
started in the expected order the assertions will be reliable.

Before, it was possible for `fail` to run & exit before `exit`,
for example. The `running` service also ensures there's always
at least one other "running" container when we do an abort.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
@glours glours enabled auto-merge April 24, 2024 09:03
@glours glours merged commit b53b8b2 into docker:main Apr 24, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants