MCPcopy Index your code
hub / github.com/cortexproject/cortex / TestStopAndDrainTimer_FiredTimer

Function TestStopAndDrainTimer_FiredTimer

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

Source from the content-addressed store, hash-verified

23}
24
25func TestStopAndDrainTimer_FiredTimer(t *testing.T) {
26 timer := time.NewTimer(time.Nanosecond)
27 // Wait for it to fire.
28 time.Sleep(time.Millisecond)
29
30 StopAndDrainTimer(timer)
31
32 // Channel should be empty after stop+drain.
33 select {
34 case <-timer.C:
35 t.Fatal("expected timer channel to be drained")
36 default:
37 }
38}
39
40func TestResetTimer(t *testing.T) {
41 timer := time.NewTimer(time.Hour)

Callers

nothing calls this directly

Calls 1

StopAndDrainTimerFunction · 0.85

Tested by

no test coverage detected