mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
chore(cli): increase healthcheck timeout in TestSupportbundle (#17291)
Fixes https://github.com/coder/internal/issues/272 * Increases healthcheck timeout in tests. This seems to be the most usual cause of test failures. * Adds a non-nilness check before caching a healthcheck report. * Modifies the HTTP response code to 503 (was 404) when no healthcheck report is available. 503 seems to be a better indicator of the server state in this case, whereas 404 could be misinterpreted as a typo in the healthcheck URL.
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user