Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 6 additions & 3 deletions cli/support_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ func TestSupportBundle(t *testing.T) {
secretValue := uuid.NewString()
seedSecretDeploymentOptions(t, &dc, secretValue)
client, db := coderdtest.NewWithDatabase(t, &coderdtest.Options{
DeploymentValues: dc.Values,
DeploymentValues: dc.Values,
HealthcheckTimeout: testutil.WaitSuperLong,
})
owner := coderdtest.CreateFirstUser(t, client)
r := dbfake.WorkspaceBuild(t, db, database.WorkspaceTable{
Expand Down Expand Up @@ -113,7 +114,8 @@ func TestSupportBundle(t *testing.T) {
secretValue := uuid.NewString()
seedSecretDeploymentOptions(t, &dc, secretValue)
client := coderdtest.New(t, &coderdtest.Options{
DeploymentValues: dc.Values,
DeploymentValues: dc.Values,
HealthcheckTimeout: testutil.WaitSuperLong,
})
_ = coderdtest.CreateFirstUser(t, client)

Expand All @@ -133,7 +135,8 @@ func TestSupportBundle(t *testing.T) {
secretValue := uuid.NewString()
seedSecretDeploymentOptions(t, &dc, secretValue)
client, db := coderdtest.NewWithDatabase(t, &coderdtest.Options{
DeploymentValues: dc.Values,
DeploymentValues: dc.Values,
HealthcheckTimeout: testutil.WaitSuperLong,
})
admin := coderdtest.CreateFirstUser(t, client)
r := dbfake.WorkspaceBuild(t, db, database.WorkspaceTable{
Expand Down
6 changes: 4 additions & 2 deletions coderd/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ func (api *API) debugDeploymentHealth(rw http.ResponseWriter, r *http.Request) {
defer cancel()

report := api.HealthcheckFunc(ctx, apiKey)
api.healthCheckCache.Store(report)
if report != nil { // Only store non-nil reports.
api.healthCheckCache.Store(report)
}
return report, nil
})

select {
case <-ctx.Done():
httpapi.Write(ctx, rw, http.StatusNotFound, codersdk.Response{
httpapi.Write(ctx, rw, http.StatusServiceUnavailable, codersdk.Response{
Message: "Healthcheck is in progress and did not complete in time. Try again in a few seconds.",
})
return
Expand Down
2 changes: 1 addition & 1 deletion coderd/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func TestDebugHealth(t *testing.T) {
require.NoError(t, err)
defer res.Body.Close()
_, _ = io.ReadAll(res.Body)
require.Equal(t, http.StatusNotFound, res.StatusCode)
require.Equal(t, http.StatusServiceUnavailable, res.StatusCode)
})

t.Run("Refresh", func(t *testing.T) {
Expand Down