Add dependency cenkalti/backoff

This commit is contained in:
Alexander Neumann 2017-10-14 15:07:19 +02:00
parent 897c923cc9
commit 3eea555155
18 changed files with 1046 additions and 1 deletions

27
vendor/github.com/cenkalti/backoff/backoff_test.go generated vendored Normal file
View file

@ -0,0 +1,27 @@
package backoff
import (
"testing"
"time"
)
func TestNextBackOffMillis(t *testing.T) {
subtestNextBackOff(t, 0, new(ZeroBackOff))
subtestNextBackOff(t, Stop, new(StopBackOff))
}
func subtestNextBackOff(t *testing.T, expectedValue time.Duration, backOffPolicy BackOff) {
for i := 0; i < 10; i++ {
next := backOffPolicy.NextBackOff()
if next != expectedValue {
t.Errorf("got: %d expected: %d", next, expectedValue)
}
}
}
func TestConstantBackOff(t *testing.T) {
backoff := NewConstantBackOff(time.Second)
if backoff.NextBackOff() != time.Second {
t.Error("invalid interval")
}
}