-
Notifications
You must be signed in to change notification settings - Fork 821
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(sdk-metrics): fix flaky LastValueAggregator test by using fake timer #3587
fix(sdk-metrics): fix flaky LastValueAggregator test by using fake timer #3587
Conversation
2ed462d
to
c8a0395
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3587 +/- ##
==========================================
- Coverage 93.90% 90.84% -3.07%
==========================================
Files 255 77 -178
Lines 7763 1671 -6092
Branches 1613 339 -1274
==========================================
- Hits 7290 1518 -5772
+ Misses 473 153 -320
|
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.
👍
According to the logs in #3572,
The timeout is used to verify the sample time of the accumulation. In #3572, I found that the merged last value accumulation has a sample time of milliseconds precision. I'd think that the flakiness is introduced in #3514, which changed the sample time precision to milliseconds. In the tests, we use sleep 1ms to increase the sample time of the updated accumulation. Although I can not reproduce the flaky issue locally, I think we should loosen the 1ms sleep too. |
Thank you for the input 🙂 If I understand correctly, this was exactly the case in my testing. Both aggregations had the same timestamp. My guess is that the reason is that
If I loosen the sleep to 100ms (or even 2ms without using fake timers) the failures don't occur anymore. I have changed the sleep to be 100ms even with the fake timer in f62ab0d 🙂 |
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.
Thanks! LGTM
Which problem is this PR solving?
This PR fixes the flaky test described in #3572 by using fake timers instead of setting and awaiting timeouts.
Fixes #3572
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Checklist: