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

Function TestRetry_NonRetryableError

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

Source from the content-addressed store, hash-verified

163}
164
165func TestRetry_NonRetryableError(t *testing.T) {
166 t.Parallel()
167
168 calls := 0
169 err := chatretry.Retry(context.Background(), func(_ context.Context) error {
170 calls++
171 return xerrors.New("invalid api key")
172 }, nil)
173
174 require.Error(t, err)
175 require.EqualError(t, err, "invalid api key")
176 require.Equal(t, 1, calls)
177 require.Equal(
178 t,
179 chaterror.Classify(xerrors.New("invalid api key")),
180 chaterror.Classify(err),
181 )
182}
183
184func TestRetry_ContextCanceledDuringWait(t *testing.T) {
185 t.Parallel()

Callers

nothing calls this directly

Calls 5

RetryFunction · 0.92
ClassifyFunction · 0.92
NewMethod · 0.65
ErrorMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected