feat: add dismissed property to the healthcheck section (#10940)

This commit is contained in:
Marcin Tojek
2023-11-29 17:37:40 +01:00
committed by GitHub
parent d374becdeb
commit 2b574e2b2d
19 changed files with 225 additions and 38 deletions

View File

@ -67,6 +67,26 @@ func TestDatabase(t *testing.T) {
assert.Contains(t, *report.Error, err.Error())
})
t.Run("DismissedError", func(t *testing.T) {
t.Parallel()
var (
ctx, cancel = context.WithTimeout(context.Background(), testutil.WaitShort)
report = healthcheck.DatabaseReport{}
db = dbmock.NewMockStore(gomock.NewController(t))
err = xerrors.New("ping error")
)
defer cancel()
db.EXPECT().Ping(gomock.Any()).Return(time.Duration(0), err)
report.Run(ctx, &healthcheck.DatabaseReportOptions{DB: db, Dismissed: true})
assert.Equal(t, health.SeverityError, report.Severity)
assert.True(t, report.Dismissed)
require.NotNil(t, report.Error)
})
t.Run("Median", func(t *testing.T) {
t.Parallel()