MCPcopy Create free account
hub / github.com/coder/coder / TestRetry_ContextCanceledDuringFn

Function TestRetry_ContextCanceledDuringFn

coderd/x/chatd/chatretry/chatretry_test.go:203–216  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

201}
202
203func TestRetry_ContextCanceledDuringFn(t *testing.T) {
204 t.Parallel()
205
206 ctx, cancel := context.WithCancel(context.Background())
207
208 err := chatretry.Retry(ctx, func(_ context.Context) error {
209 cancel()
210 return xerrors.New("overloaded")
211 }, nil)
212
213 if !errors.Is(err, context.Canceled) {
214 t.Fatalf("expected context.Canceled, got %v", err)
215 }
216}
217
218func TestRetry_OnRetryCalledWithCorrectArgs(t *testing.T) {
219 t.Parallel()

Callers

nothing calls this directly

Calls 4

RetryFunction · 0.92
NewMethod · 0.65
IsMethod · 0.45
FatalfMethod · 0.45

Tested by

no test coverage detected