1
0
Fork 0
mirror of https://github.com/Luzifer/elastic_cron.git synced 2024-11-14 00:12:46 +00:00
elastic_cron/vendor/github.com/cenkalti/backoff/context_test.go
Knut Ahlers 421f2bfe84
Update dependencies
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2017-09-13 13:15:16 +02:00

26 lines
396 B
Go

package backoff
import (
"testing"
"time"
"golang.org/x/net/context"
)
func TestContext(t *testing.T) {
b := NewConstantBackOff(time.Millisecond)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
cb := WithContext(b, ctx)
if cb.Context() != ctx {
t.Error("invalid context")
}
cancel()
if cb.NextBackOff() != Stop {
t.Error("invalid next back off")
}
}