Skip to content

fix: workspaceapps: overloaded test server responds with 502s #5255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 2, 2022
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
}