MCPcopy
hub / github.com/nats-io/nats.go / TestTimerPool

Function TestTimerPool

timer_test.go:21–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19)
20
21func TestTimerPool(t *testing.T) {
22 var tp timerPool
23
24 for i := 0; i < 10; i++ {
25 tm := tp.Get(time.Millisecond * 20)
26
27 select {
28 case <-tm.C:
29 t.Errorf("Timer already expired")
30 continue
31 default:
32 }
33
34 select {
35 case <-tm.C:
36 case <-time.After(time.Millisecond * 100):
37 t.Errorf("Timer didn't expire in time")
38 }
39
40 tp.Put(tm)
41 }
42}

Callers

nothing calls this directly

Calls 3

GetMethod · 0.95
PutMethod · 0.95
ErrorfMethod · 0.80

Tested by

no test coverage detected