(t *testing.T)
| 60 | } |
| 61 | |
| 62 | func TestRetryMultipleAttemptsTimerReset(t *testing.T) { |
| 63 | var attempts atomic.Int32 |
| 64 | op := buildZeroArgAsync(t, async.RetryBinding(func(ctx context.Context, args ...ref.Val) ref.Val { |
| 65 | a := attempts.Add(1) |
| 66 | if a < 3 { |
| 67 | return types.WrapErr(retryableTestErr{}) |
| 68 | } |
| 69 | return types.Int(100) |
| 70 | }, async.RetryAttempts(4), async.RetryBackoff(5*time.Millisecond))) |
| 71 | |
| 72 | res := <-op(context.Background()) |
| 73 | if res.Equal(types.Int(100)) != types.True { |
| 74 | t.Fatalf("result = %v, want 100", res) |
| 75 | } |
| 76 | if got := attempts.Load(); got != 3 { |
| 77 | t.Errorf("attempts = %d, want 3", got) |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | func TestRetryMaxAttemptsExhausted(t *testing.T) { |
| 82 | var attempts atomic.Int32 |
nothing calls this directly
no test coverage detected