Skip to content

Conversation

@Benehiko
Copy link
Member

@Benehiko Benehiko commented Mar 12, 2025

Fixes TestRunAttachTermination flaky runs. It seems like we weren't halting on the waitFunc so if the process was fast enough to setup the signal handler and execute waitExitOrRemoved.
https://github.com/docker/cli/blob/master/cli/command/container/run.go#L199

- What I did

Added a line waiting for the killCh channel to close inside the mocked waitFunc.

- How I did it

- How to verify it

go test -race -run=TestRunAttachTermination -count=1000 -v -failfast ./cli/command/container/...

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

@codecov-commenter
Copy link

codecov-commenter commented Mar 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.28%. Comparing base (2d74733) to head (966b441).
Report is 18 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5926      +/-   ##
==========================================
- Coverage   59.33%   59.28%   -0.05%     
==========================================
  Files         358      358              
  Lines       29783    29830      +47     
==========================================
+ Hits        17672    17685      +13     
- Misses      11142    11173      +31     
- Partials      969      972       +3     
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Benehiko Benehiko force-pushed the fix-attach-test-flake branch from 4aecba8 to ed8df97 Compare March 12, 2025 12:00
@Benehiko Benehiko added area/testing kind/bugfix PR's that fix bugs labels Mar 12, 2025
@Benehiko Benehiko self-assigned this Mar 12, 2025
@Benehiko Benehiko marked this pull request as ready for review March 12, 2025 12:12
@Benehiko Benehiko requested a review from a team March 12, 2025 12:12
@thaJeztah
Copy link
Member

@Benehiko could you add something similar to the PR's description in the commit message so that the commit message describes the changes made?

This patch fixes the `TestRunAttachTermination` flaky runs.
It seems like we weren't halting on the `waitFunc` so if the
process was fast enough to setup the signal handler and execute
`waitExitOrRemoved`. We now instead wait for the `killCh` channel
to close inside the mocked `waitFunc`.

Signed-off-by: Alano Terblanche <[email protected]>
@Benehiko Benehiko force-pushed the fix-attach-test-flake branch from ed8df97 to 966b441 Compare March 18, 2025 15:14
@Benehiko
Copy link
Member Author

@thaJeztah PTAL :)

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM, thx!

@thaJeztah thaJeztah merged commit 3b45f3c into docker:master Mar 19, 2025
87 checks passed
@vvoland vvoland added this to the 28.0.3 milestone Mar 20, 2025

assert.NilError(t, syscall.Kill(syscall.Getpid(), syscall.SIGINT))
// end stream from "container" so that we'll detach
conn.Close()
Copy link
Collaborator

@vvoland vvoland Mar 24, 2025

Choose a reason for hiding this comment

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

What was the reason for removing conn.Close? @Benehiko

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Is it still being flaky? From my testing closing the connection here didn't add anything.

Copy link
Collaborator

Choose a reason for hiding this comment

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

See: #5957

It's needed for the cmdErrC to actually receive the event. Removing it depended on the bug that was introduced.

I'm wondering if the flakiness was actually caused by the bug fixed by the mentioned PR 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/testing kind/bugfix PR's that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: TestInitTtySizeErrors / TestRunAttachTermination

5 participants