mirror of
https://github.com/openfaas/faas.git
synced 2025-06-22 23:03:24 +00:00
Merge master into breakout_swarm
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
29
gateway/vendor/github.com/nats-io/go-nats/timer_test.go
generated
vendored
Normal file
29
gateway/vendor/github.com/nats-io/go-nats/timer_test.go
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user