metrics: fix flaky test`TestExpDecaySampleNanosecondRegression` (#29832)

pull/29831/head^2
Halimao 6 months ago committed by GitHub
parent 61b3d93bb0
commit 08fe6a8614
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      metrics/sample_test.go

@ -125,12 +125,12 @@ func TestExpDecaySample(t *testing.T) {
// The priority becomes +Inf quickly after starting if this is done, // The priority becomes +Inf quickly after starting if this is done,
// effectively freezing the set of samples until a rescale step happens. // effectively freezing the set of samples until a rescale step happens.
func TestExpDecaySampleNanosecondRegression(t *testing.T) { func TestExpDecaySampleNanosecondRegression(t *testing.T) {
sw := NewExpDecaySample(100, 0.99) sw := NewExpDecaySample(1000, 0.99)
for i := 0; i < 100; i++ { for i := 0; i < 1000; i++ {
sw.Update(10) sw.Update(10)
} }
time.Sleep(1 * time.Millisecond) time.Sleep(1 * time.Millisecond)
for i := 0; i < 100; i++ { for i := 0; i < 1000; i++ {
sw.Update(20) sw.Update(20)
} }
s := sw.Snapshot() s := sw.Snapshot()

Loading…
Cancel
Save