1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-05-02 22:17:10 +08:00
Dejan Mijic bcc0bfdc3d
Integrate message writer service
Moved main method to top-level cmd directory. Extracted its dockerfile
as well.

Signed-off-by: Dejan Mijic <dejan@mainflux.com>
2017-09-23 01:22:21 +02:00

30 lines
393 B
Go

package nats
import (
"testing"
"time"
)
func TestTimerPool(t *testing.T) {
var tp timerPool
for i := 0; i < 10; i++ {
tm := tp.Get(time.Millisecond * 20)
select {
case <-tm.C:
t.Errorf("Timer already expired")
continue
default:
}
select {
case <-tm.C:
case <-time.After(time.Millisecond * 100):
t.Errorf("Timer didn't expire in time")
}
tp.Put(tm)
}
}