-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 flaky client metrics test #2170
Conversation
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Yuri Shkuro <ys@uber.com>
Codecov Report
@@ Coverage Diff @@
## master #2170 +/- ##
==========================================
+ Coverage 96.14% 96.16% +0.01%
==========================================
Files 219 219
Lines 10585 10585
==========================================
+ Hits 10177 10179 +2
+ Misses 353 351 -2
Partials 55 55
Continue to review full report at Codecov.
|
time.Sleep(500 * time.Microsecond) | ||
|
||
t.Run("detect new client", func(t *testing.T) { | ||
assert.EqualValues(t, 0, getGauge(), "start with gauge=0") |
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.
Why is this needed? What else could set the gauge to a non zero value earlier?
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.
it's a sanity check
params := ClientMetricsReporterParams{ | ||
ExpireFrequency: 100 * time.Microsecond, | ||
ExpireTTL: 5 * time.Millisecond, | ||
ExpireFrequency: 1 * time.Millisecond, |
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 simply be time.Millisecond
require.EqualValues(t, 1, gauge) | ||
}) | ||
|
||
t.Run("detect stale client", func(t *testing.T) { |
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.
Is it difficult to start with gauges at a specific value instead of relying on EmitBatch
?
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.
I am not sure, it would probably require some backdoor. This way we're testing cleanly via the official APIs.
Resolves #2108
Supersedes #2168