(t *testing.T)
| 30 | } |
| 31 | |
| 32 | func TestExponentialBackoff(t *testing.T) { |
| 33 | retry := ExponentialBackoff(10*time.Millisecond, 300*time.Millisecond) |
| 34 | for i, exp := range []time.Duration{ |
| 35 | 10 * time.Millisecond, |
| 36 | 10 * time.Millisecond, |
| 37 | 16 * time.Millisecond, |
| 38 | 32 * time.Millisecond, |
| 39 | 64 * time.Millisecond, |
| 40 | 128 * time.Millisecond, |
| 41 | 256 * time.Millisecond, |
| 42 | 300 * time.Millisecond, |
| 43 | 300 * time.Millisecond, |
| 44 | } { |
| 45 | if got := retry.NextBackoff(); exp != got { |
| 46 | t.Fatalf("expected %d to be %v, got %v", i, exp, got) |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | func TestLimitRetry(t *testing.T) { |
| 52 | retry := LimitRetry(LinearBackoff(time.Second), 2) |
nothing calls this directly
no test coverage detected