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

Function TestRetryStandardError

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

Source from the content-addressed store, hash-verified

146}
147
148func TestRetryStandardError(t *testing.T) {
149 var attempts atomic.Int32
150 op := buildZeroArgAsync(t, async.RetryBinding(func(ctx context.Context, args ...ref.Val) ref.Val {
151 attempts.Add(1)
152 return types.NewErr("generic error")
153 }, async.RetryAttempts(5), async.RetryBackoff(10*time.Millisecond)))
154
155 res := <-op(context.Background())
156 if !types.IsError(res) || !strings.Contains(res.(*types.Err).Error(), "generic error") {
157 t.Fatalf("result = %v, want 'generic error'", res)
158 }
159 if got := attempts.Load(); got != 1 {
160 t.Errorf("attempts = %d, want 1 (standard error should not be retried)", got)
161 }
162}
163
164type mockAsyncCall struct {
165 id int64

Callers

nothing calls this directly

Calls 9

RetryBindingFunction · 0.92
NewErrFunction · 0.92
RetryAttemptsFunction · 0.92
RetryBackoffFunction · 0.92
IsErrorFunction · 0.92
buildZeroArgAsyncFunction · 0.85
AddMethod · 0.65
ContainsMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected