Skip to content
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

Merged
merged 22 commits into from
Oct 28, 2022

Conversation

mattia-fumo
Copy link
Contributor

Fixed a bug in awaitable resources that caused some events to be skipped because time with different precision were wrongly compared

@codecov-commenter
Copy link

Codecov Report

Base: 67.92% // Head: 67.78% // Decreases project coverage by -0.14% ⚠️

Coverage data is based on head (3d0500d) compared to base (88e6f72).
Patch coverage: 57.14% of modified lines in pull request are covered.

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     
Impacted Files Coverage Δ
pkg/deploy/apply.go 65.65% <57.14%> (-0.51%) ⬇️

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -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:
Copy link
Member

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?

Copy link
Contributor Author

@mattia-fumo mattia-fumo Oct 21, 2022

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

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)

@Danielecina Danielecina merged commit ff9b665 into main Oct 28, 2022
@davidebianchi davidebianchi deleted the fix/awaitable-resources-retry-watch branch October 28, 2022 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants