diff --git a/coderd/healthcheck/accessurl.go b/coderd/healthcheck/accessurl.go index 10d2d936fb712..fcab27463e3a8 100644 --- a/coderd/healthcheck/accessurl.go +++ b/coderd/healthcheck/accessurl.go @@ -33,6 +33,7 @@ func (r *AccessURLReport) Run(ctx context.Context, opts *AccessURLReportOptions) ctx, cancel := context.WithTimeout(ctx, 5*time.Second) defer cancel() + r.Warnings = []string{} if opts.AccessURL == nil { r.Error = ptr.Ref("access URL is nil") return diff --git a/coderd/healthcheck/database.go b/coderd/healthcheck/database.go index 9a8726a484361..f8a0d655796df 100644 --- a/coderd/healthcheck/database.go +++ b/coderd/healthcheck/database.go @@ -32,6 +32,7 @@ type DatabaseReportOptions struct { } func (r *DatabaseReport) Run(ctx context.Context, opts *DatabaseReportOptions) { + r.Warnings = []string{} r.ThresholdMS = opts.Threshold.Milliseconds() if r.ThresholdMS == 0 { r.ThresholdMS = DatabaseDefaultThreshold.Milliseconds() diff --git a/coderd/healthcheck/derphealth/derp.go b/coderd/healthcheck/derphealth/derp.go index 94cc89307d565..83dfcbf4a15a2 100644 --- a/coderd/healthcheck/derphealth/derp.go +++ b/coderd/healthcheck/derphealth/derp.go @@ -89,6 +89,7 @@ type ReportOptions struct { func (r *Report) Run(ctx context.Context, opts *ReportOptions) { r.Healthy = true r.Regions = map[int]*RegionReport{} + r.Warnings = []string{} wg := &sync.WaitGroup{} mu := sync.Mutex{} diff --git a/coderd/healthcheck/healthcheck.go b/coderd/healthcheck/healthcheck.go index d59de08592203..80af31ae524a2 100644 --- a/coderd/healthcheck/healthcheck.go +++ b/coderd/healthcheck/healthcheck.go @@ -136,6 +136,7 @@ func Run(ctx context.Context, opts *ReportOptions) *Report { wg.Wait() report.Time = time.Now() + report.FailingSections = []string{} if !report.DERP.Healthy { report.FailingSections = append(report.FailingSections, SectionDERP) } diff --git a/coderd/healthcheck/healthcheck_test.go b/coderd/healthcheck/healthcheck_test.go index 1a1840a37d581..7d55366170f61 100644 --- a/coderd/healthcheck/healthcheck_test.go +++ b/coderd/healthcheck/healthcheck_test.go @@ -58,7 +58,7 @@ func TestHealthcheck(t *testing.T) { }, }, healthy: true, - failingSections: nil, + failingSections: []string{}, }, { name: "DERPFail", checker: &testChecker{ @@ -95,7 +95,7 @@ func TestHealthcheck(t *testing.T) { }, }, healthy: true, - failingSections: nil, + failingSections: []string{}, }, { name: "AccessURLFail", checker: &testChecker{ diff --git a/coderd/healthcheck/websocket.go b/coderd/healthcheck/websocket.go index 5723cf48bc9a9..46ce08f0f1bdd 100644 --- a/coderd/healthcheck/websocket.go +++ b/coderd/healthcheck/websocket.go @@ -33,6 +33,7 @@ func (r *WebsocketReport) Run(ctx context.Context, opts *WebsocketReportOptions) ctx, cancel := context.WithTimeout(ctx, 5*time.Second) defer cancel() + r.Warnings = []string{} u, err := opts.AccessURL.Parse("/api/v2/debug/ws") if err != nil { r.Error = convertError(xerrors.Errorf("parse access url: %w", err))