Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP
  • Loading branch information
mtojek committed Dec 2, 2022
commit c8ab9191a79fd4cef8aaa908dc77a0776ede0a32
11 changes: 11 additions & 0 deletions coderd/client_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package coderd_test

import (
"context"
"net/http"

"github.com/stretchr/testify/require"
Expand All @@ -18,3 +19,13 @@ func doWithRetries(t require.TestingT, client *codersdk.Client, req *http.Reques
}, testutil.WaitShort, testutil.IntervalFast)
return resp, err
}

func requestWithRetries(t require.TestingT, client *codersdk.Client, ctx context.Context, method, path string, body interface{}, opts ...codersdk.RequestOption) (*http.Response, error) {
var resp *http.Response
var err error
require.Eventually(t, func() bool {
resp, err = client.Request(ctx, method, path, body, opts...)
return resp.StatusCode != http.StatusBadGateway
}, testutil.WaitShort, testutil.IntervalFast)
return resp, err
}