MCPcopy Index your code
hub / github.com/coder/coder / doWithRetries

Function doWithRetries

coderd/workspaceapps/apptest/setup.go:568–583  ·  view source on GitHub ↗
(t require.TestingT, client *codersdk.Client, req *http.Request)

Source from the content-addressed store, hash-verified

566}
567
568func doWithRetries(t require.TestingT, client *codersdk.Client, req *http.Request) (*http.Response, error) {
569 var resp *http.Response
570 var err error
571 require.Eventually(t, func() bool {
572 // nolint // only requests which are not passed upstream have a body closed
573 resp, err = client.HTTPClient.Do(req)
574 if resp != nil && resp.StatusCode == http.StatusBadGateway {
575 if resp.Body != nil {
576 resp.Body.Close()
577 }
578 return false
579 }
580 return true
581 }, testutil.WaitLong, testutil.IntervalFast)
582 return resp, err
583}
584
585func requestWithRetries(ctx context.Context, t testing.TB, client *codersdk.Client, method, urlOrPath string, body interface{}, opts ...codersdk.RequestOption) (*http.Response, error) {
586 t.Helper()

Callers 1

RunFunction · 0.85

Calls 2

DoMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected