MCPcopy Create free account
hub / github.com/cel-expr/cel-go / TestRetryMultipleAttemptsTimerReset

Function TestRetryMultipleAttemptsTimerReset

cel/async/async_test.go:62–79  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

60}
61
62func 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
81func TestRetryMaxAttemptsExhausted(t *testing.T) {
82 var attempts atomic.Int32

Callers

nothing calls this directly

Calls 8

RetryBindingFunction · 0.92
WrapErrFunction · 0.92
IntTypeAlias · 0.92
RetryAttemptsFunction · 0.92
RetryBackoffFunction · 0.92
buildZeroArgAsyncFunction · 0.85
AddMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected