-
Notifications
You must be signed in to change notification settings - Fork 2.1k
test: fix flaky TestRunAttachTermination #5926
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
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:
|
4aecba8 to
ed8df97
Compare
|
@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]>
ed8df97 to
966b441
Compare
|
@thaJeztah PTAL :) |
thaJeztah
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thx!
|
|
||
| assert.NilError(t, syscall.Kill(syscall.Getpid(), syscall.SIGINT)) | ||
| // end stream from "container" so that we'll detach | ||
| conn.Close() |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 🤔
Fixes
TestRunAttachTerminationflaky runs. It seems like we weren't halting on thewaitFuncso if the process was fast enough to setup the signal handler and executewaitExitOrRemoved.https://github.com/docker/cli/blob/master/cli/command/container/run.go#L199
- What I did
Added a line waiting for the
killChchannel to close inside the mockedwaitFunc.- 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)