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

Function TestRetry_TransientThenSuccess

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

Source from the content-addressed store, hash-verified

133}
134
135func TestRetry_TransientThenSuccess(t *testing.T) {
136 t.Parallel()
137
138 calls := 0
139 err := chatretry.Retry(context.Background(), func(_ context.Context) error {
140 calls++
141 if calls == 1 {
142 return xerrors.New("service unavailable")
143 }
144 return nil
145 }, nil)
146 require.NoError(t, err)
147 require.Equal(t, 2, calls)
148}
149
150func TestRetry_MultipleTransientThenSuccess(t *testing.T) {
151 t.Parallel()

Callers

nothing calls this directly

Calls 3

RetryFunction · 0.92
NewMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected