fix: use doWithRetries when making HTTP calls (#5344)

This commit is contained in:
Marcin Tojek 2022-12-08 10:24:50 +01:00 committed by GitHub
parent 59af8349c6
commit c063ac24a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -414,7 +414,7 @@ func TestWorkspaceApplicationAuth(t *testing.T) {
t.Log("navigating to: ", gotLocation.String())
req, err = http.NewRequestWithContext(ctx, "GET", gotLocation.String(), nil)
require.NoError(t, err)
resp, err = client.HTTPClient.Do(req)
resp, err = doWithRetries(t, client, req)
require.NoError(t, err)
resp.Body.Close()
require.Equal(t, http.StatusTemporaryRedirect, resp.StatusCode)
@ -471,7 +471,7 @@ func TestWorkspaceApplicationAuth(t *testing.T) {
req, err = http.NewRequestWithContext(ctx, "GET", gotLocation.String(), nil)
require.NoError(t, err)
req.Header.Set(codersdk.SessionCustomHeader, apiKey)
resp, err = client.HTTPClient.Do(req)
resp, err = doWithRetries(t, client, req)
require.NoError(t, err)
resp.Body.Close()
require.Equal(t, http.StatusOK, resp.StatusCode)
@ -1153,7 +1153,7 @@ func TestWorkspaceAppsNonCanonicalHeaders(t *testing.T) {
req.Header["Sec-WebSocket-Key"] = []string{secWebSocketKey}
req.Header.Set(codersdk.SessionCustomHeader, client.SessionToken())
resp, err := client.HTTPClient.Do(req)
resp, err := doWithRetries(t, client, req)
require.NoError(t, err)
defer resp.Body.Close()
@ -1205,7 +1205,7 @@ func TestWorkspaceAppsNonCanonicalHeaders(t *testing.T) {
req.Header["Sec-WebSocket-Key"] = []string{secWebSocketKey}
req.Header.Set(codersdk.SessionCustomHeader, client.SessionToken())
resp, err := client.HTTPClient.Do(req)
resp, err := doWithRetries(t, client, req)
require.NoError(t, err)
defer resp.Body.Close()