MCPcopy Create free account
hub / github.com/cortexproject/cortex / TestDurationWithJitter

Function TestDurationWithJitter

pkg/util/time_test.go:36–44  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34}
35
36func TestDurationWithJitter(t *testing.T) {
37 const numRuns = 1000
38
39 for range numRuns {
40 actual := DurationWithJitter(time.Minute, 0.5)
41 assert.GreaterOrEqual(t, int64(actual), int64(30*time.Second))
42 assert.LessOrEqual(t, int64(actual), int64(90*time.Second))
43 }
44}
45
46func TestDurationWithJitter_ZeroInputDuration(t *testing.T) {
47 assert.Equal(t, time.Duration(0), DurationWithJitter(time.Duration(0), 0.5))

Callers

nothing calls this directly

Calls 1

DurationWithJitterFunction · 0.85

Tested by

no test coverage detected