feat: expose append-only ledger health
This commit is contained in:
@@ -21,9 +21,10 @@ func NewService(database Database) *Service {
|
||||
}
|
||||
|
||||
func (s *Service) Check(ctx context.Context) Status {
|
||||
status := Status{Serving: true}
|
||||
status := Status{}
|
||||
if s.database != nil {
|
||||
status.DatabaseReady = s.database.Ping(ctx) == nil
|
||||
}
|
||||
status.Serving = status.DatabaseReady
|
||||
return status
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestCheckReportsDatabaseReadiness(t *testing.T) {
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
got := NewService(tc.db).Check(context.Background())
|
||||
if !got.Serving || got.DatabaseReady != tc.ready {
|
||||
if got.Serving != tc.ready || got.DatabaseReady != tc.ready {
|
||||
t.Fatalf("unexpected status: %+v", got)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user