(t *testing.T)
| 750 | } |
| 751 | |
| 752 | func TestBackoff_Defaults(t *testing.T) { |
| 753 | t.Parallel() |
| 754 | |
| 755 | b := lifecycle.Backoff{} |
| 756 | d0 := lifecycle.ExportedBackoffDelay(b, 0, func() float64 { return 0 }) |
| 757 | d1 := lifecycle.ExportedBackoffDelay(b, 1, func() float64 { return 0 }) |
| 758 | d2 := lifecycle.ExportedBackoffDelay(b, 2, func() float64 { return 0 }) |
| 759 | d6 := lifecycle.ExportedBackoffDelay(b, 6, func() float64 { return 0 }) |
| 760 | |
| 761 | assert.Check(t, is.Equal(d0, time.Second)) |
| 762 | assert.Check(t, is.Equal(d1, 2*time.Second)) |
| 763 | assert.Check(t, is.Equal(d2, 4*time.Second)) |
| 764 | // 1<<6 = 64s, capped to default Max = 32s. |
| 765 | assert.Check(t, is.Equal(d6, 32*time.Second)) |
| 766 | } |
| 767 | |
| 768 | func TestBackoff_Jitter(t *testing.T) { |
| 769 | t.Parallel() |
nothing calls this directly
no test coverage detected