(t *testing.T)
| 213 | } |
| 214 | |
| 215 | func TestRetryLoopFastFail(t *testing.T) { |
| 216 | numTimesInvoked := 0 |
| 217 | worker := func() (shouldRetry bool, err error, value any) { |
| 218 | numTimesInvoked += 1 |
| 219 | return true, nil, nil |
| 220 | } |
| 221 | |
| 222 | err, _ := RetryLoop(TestCtx(t), t.Name(), worker, CreateFastFailRetrySleeperFunc()) |
| 223 | require.ErrorContains(t, err, "giving up after 1 attempts") |
| 224 | require.Equal(t, 1, numTimesInvoked) |
| 225 | } |
| 226 | |
| 227 | func TestRetryLoopContextCancellation(t *testing.T) { |
| 228 | var invoked atomic.Bool |
nothing calls this directly
no test coverage detected