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

Function TestResetTimer_AfterFired

pkg/util/timer/timer_test.go:54–69  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

52}
53
54func TestResetTimer_AfterFired(t *testing.T) {
55 timer := time.NewTimer(time.Nanosecond)
56 // Wait for it to fire.
57 time.Sleep(time.Millisecond)
58 <-timer.C
59
60 // Reset after consuming the fired event.
61 ResetTimer(timer, time.Nanosecond)
62
63 select {
64 case <-timer.C:
65 // Expected.
66 case <-time.After(100 * time.Millisecond):
67 t.Fatal("expected timer to fire after reset")
68 }
69}
70
71func TestResetTimer_MultipleTimes(t *testing.T) {
72 timer := time.NewTimer(time.Hour)

Callers

nothing calls this directly

Calls 2

ResetTimerFunction · 0.85
AfterMethod · 0.80

Tested by

no test coverage detected