(t *testing.T)
| 133 | } |
| 134 | |
| 135 | func TestRetry_TransientThenSuccess(t *testing.T) { |
| 136 | t.Parallel() |
| 137 | |
| 138 | calls := 0 |
| 139 | err := chatretry.Retry(context.Background(), func(_ context.Context) error { |
| 140 | calls++ |
| 141 | if calls == 1 { |
| 142 | return xerrors.New("service unavailable") |
| 143 | } |
| 144 | return nil |
| 145 | }, nil) |
| 146 | require.NoError(t, err) |
| 147 | require.Equal(t, 2, calls) |
| 148 | } |
| 149 | |
| 150 | func TestRetry_MultipleTransientThenSuccess(t *testing.T) { |
| 151 | t.Parallel() |