(t *testing.T)
| 130 | } |
| 131 | |
| 132 | func TestRetryNonRetryableError(t *testing.T) { |
| 133 | var attempts atomic.Int32 |
| 134 | op := buildZeroArgAsync(t, async.RetryBinding(func(ctx context.Context, args ...ref.Val) ref.Val { |
| 135 | attempts.Add(1) |
| 136 | return types.WrapErr(nonRetryableTestErr{}) |
| 137 | }, async.RetryAttempts(5), async.RetryBackoff(10*time.Millisecond))) |
| 138 | |
| 139 | res := <-op(context.Background()) |
| 140 | if !types.IsError(res) || !strings.Contains(res.(*types.Err).Error(), "do not retry me") { |
| 141 | t.Fatalf("result = %v, want 'do not retry me'", res) |
| 142 | } |
| 143 | if got := attempts.Load(); got != 1 { |
| 144 | t.Errorf("attempts = %d, want 1 (non-retryable error should not be retried)", got) |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | func TestRetryStandardError(t *testing.T) { |
| 149 | var attempts atomic.Int32 |
nothing calls this directly
no test coverage detected