-
Notifications
You must be signed in to change notification settings - Fork 2.1k
tests/run: fix flaky RunAttachTermination test
#5303
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 #5303 +/- ##
==========================================
- Coverage 61.45% 61.45% -0.01%
==========================================
Files 299 299
Lines 20856 20855 -1
==========================================
- Hits 12818 12816 -2
- Misses 7122 7124 +2
+ Partials 916 915 -1 |
|
@thaJeztah @vvoland can you TAL? |
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.
overall LGTM; left two comments / questions
60f51c1 to
3be9c8f
Compare
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
3be9c8f to
1b53d4c
Compare
|
oh! LOL, I saw failures, and see you just pushed - probably need to remove the import as well |
1b53d4c to
2290f7a
Compare
|
Turns out the version was set for a reason. I added a comment. Edit: aaahh I commented the wrong SHA. I'll fix it. |
This test was just incorrect (and testing incorrect behavior): it was checking that `docker run` exited with a `context canceled` error after signalling the CLI/cancelling the command's context, but this was incorrect (and was fixed in 991b130 - which was when this test started failing). However, since this test assertion was happening inside of a goroutine, it would sometimes pass if this assertion didn't get to run before the test suite terminated. It was flaky because sometimes this assertion inside the goroutine did get to execute, but after the test finished execution, which is a big no-no. As an aside, assertions inside goroutines are generally bad, and `govet` even has a linter for this (but it only catches `t.Fatal` and `t.FailNow` calls and not `assert.Xx`. Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2290f7a to
eac8357
Compare
- What I did
This test was just incorrect (and testing incorrect behavior): it was checking that
docker runexited with acontext cancelederror after signalling the CLI/cancelling the command's context, but this was incorrect (and was fixed in991b130 - which was when this test started failing).
However, since this test assertion was happening inside of a goroutine, it would sometimes pass if it didn't get to run before the test suite terminated. It was flaky because sometimes the assertion inside the goroutine did get to execute, but after the test finished execution, which is a big no-no.
As an aside, assertions inside goroutines are generally bad, and
goveteven has a check for this (but it only catchest.Fatalandt.FailNowcalls and notassert.Xx).- How I did it
Fixed
RunAttachTerminationto test for the correct behavior, and generally cleaned the tests up a bit. Also added another test for the general/not SIGINT'ed case.- How to verify it
go test -v -count=1 -run=TestRunAttach ./cli/command/container/...- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)