MCPcopy
hub / github.com/cenkalti/backoff / TestRetryMaxElapsedTimeErrorIncludesOperationError

Function TestRetryMaxElapsedTimeErrorIncludesOperationError

retry_test.go:151–166  ·  view source on GitHub ↗

https://github.com/cenkalti/backoff/issues/181

(t *testing.T)

Source from the content-addressed store, hash-verified

149
150// https://github.com/cenkalti/backoff/issues/181
151func TestRetryMaxElapsedTimeErrorIncludesOperationError(t *testing.T) {
152 opErr := errors.New("operation error")
153
154 _, err := Retry(
155 context.Background(),
156 func() (bool, error) { return false, opErr },
157 WithMaxElapsedTime(time.Millisecond),
158 withTimer(&testTimer{}),
159 )
160 if !errors.Is(err, ErrMaxElapsedTime) {
161 t.Errorf("ErrMaxElapsedTime not in result: %v", err)
162 }
163 if !errors.Is(err, opErr) {
164 t.Errorf("operation error not in result: %v", err)
165 }
166}
167
168func TestRetryError(t *testing.T) {
169 opErr := errors.New("operation error")

Callers

nothing calls this directly

Calls 4

RetryFunction · 0.85
WithMaxElapsedTimeFunction · 0.85
withTimerFunction · 0.85
IsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…