Skip to content

feat: add dismissed property to the healthcheck section #10940

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 17 commits into from
Nov 29, 2023
Prev Previous commit
Next Next commit
ErrorDismissed
  • Loading branch information
mtojek committed Nov 29, 2023
commit ec2bb2f95b58ffe65fbf8ac102f41136c2afa0b7
28 changes: 16 additions & 12 deletions coderd/healthcheck/workspaceproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,22 @@ func TestWorkspaceProxies(t *testing.T) {
}
}

func TestWorkspaceProxy_ErrorDismissed(t *testing.T) {
t.Parallel()

var report healthcheck.WorkspaceProxyReport
report.Run(context.Background(), &healthcheck.WorkspaceProxyReportOptions{
WorkspaceProxiesFetchUpdater: &fakeWorkspaceProxyFetchUpdater{
fetchFunc: fakeFetchWorkspaceProxiesErr(assert.AnError),
updateFunc: fakeUpdateProxyHealth(assert.AnError),
},
Dismissed: true,
})

assert.True(t, report.Dismissed)
assert.Equal(t, health.SeverityWarning, report.Severity)
}

// yet another implementation of the thing
type fakeWorkspaceProxyFetchUpdater struct {
fetchFunc func(context.Context) (codersdk.RegionsResponse[codersdk.WorkspaceProxy], error)
Expand Down Expand Up @@ -236,15 +252,3 @@ func fakeUpdateProxyHealth(err error) func(context.Context) error {
return err
}
}

func TestWorkspaceProxy_Dismissed(t *testing.T) {
t.Parallel()

var report healthcheck.WorkspaceProxyReport
report.Run(context.Background(), &healthcheck.WorkspaceProxyReportOptions{
Dismissed: true,
})

assert.True(t, report.Dismissed)
assert.Equal(t, health.SeverityOK, report.Severity)
}