-
Notifications
You must be signed in to change notification settings - Fork 4.6k
test: Replace WithDialer usages with WithContextDialer #8788
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8788 +/- ##
==========================================
+ Coverage 83.33% 83.37% +0.03%
==========================================
Files 418 418
Lines 32910 33007 +97
==========================================
+ Hits 27424 27518 +94
- Misses 4088 4090 +2
- Partials 1398 1399 +1
🚀 New features to boost your workflow:
|
debddcb to
e5d0794
Compare
| dl := pl.Dialer() | ||
| conn, err := dl("", time.Duration(0)) | ||
| dl := pl.ContextDialer() | ||
| conn, err := dl(t.Context(), "") |
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.
We do not use t.Context() rather we do something like this :
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
where defaultTestTimeout = 10 * time.Second
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.
Done.
internal/testutils/pipe_listener.go
Outdated
| case <-p.done: | ||
| return nil, errClosed | ||
| case <-ctx.Done(): | ||
| return nil, context.Cause(ctx) |
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.
Can you change this to return ctx.Err()
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.
Done.
This will properly pass on cancellation requests, and reduce usage of a deprecated method. Signed-off-by: Tom Wieczorek <twieczorek@mirantis.com>
e5d0794 to
7965ceb
Compare
This will properly pass on cancellation requests, and reduce usage of a deprecated method.
See:
RELEASE NOTES: none