-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix: awaitable resources start time comparison #60
Conversation
Codecov ReportBase: 67.92% // Head: 67.78% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #60 +/- ##
==========================================
- Coverage 67.92% 67.78% -0.15%
==========================================
Files 10 10
Lines 1400 1403 +3
==========================================
Hits 951 951
- Misses 354 356 +2
- Partials 95 96 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@@ -136,7 +136,10 @@ func withAwaitableResource(apply applyFunction) applyFunction { | |||
// consume watcher events and wait for the resource to complete or exit because of timeout | |||
for { | |||
select { | |||
case event := <-watchEvents: | |||
case event, ok := <-watchEvents: |
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 add some test to replicate the bug?
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.
Ok, i added some tests, in particular this one that replicates the bug
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.
In the said test I've mocked time.Now
in order to simulate a completion event fired in the same second as the watch start time.
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 had a precision problem comparing the start time (in nanoseconds) and event time (in seconds)
Fixed a bug in awaitable resources that caused some events to be skipped because time with different precision were wrongly compared