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

Function TestResetTimer

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

Source from the content-addressed store, hash-verified

38}
39
40func TestResetTimer(t *testing.T) {
41 timer := time.NewTimer(time.Hour)
42
43 // Reset to a very short duration.
44 ResetTimer(timer, time.Nanosecond)
45
46 select {
47 case <-timer.C:
48 // Expected.
49 case <-time.After(100 * time.Millisecond):
50 t.Fatal("expected timer to fire after reset")
51 }
52}
53
54func TestResetTimer_AfterFired(t *testing.T) {
55 timer := time.NewTimer(time.Nanosecond)

Callers

nothing calls this directly

Calls 2

ResetTimerFunction · 0.85
AfterMethod · 0.80

Tested by

no test coverage detected