chore: establish local platform baseline
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package health
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestReadyReportsDependencyFailure(t *testing.T) {
|
||||
checker := NewChecker(time.Second, map[string]CheckFunc{
|
||||
"database": func(context.Context) error { return nil },
|
||||
"redis": func(context.Context) error { return errors.New("unavailable") },
|
||||
})
|
||||
result := checker.Ready(context.Background())
|
||||
if result.Status != "not_ready" {
|
||||
t.Fatalf("status = %s, want not_ready", result.Status)
|
||||
}
|
||||
if result.Checks["database"] != "up" || result.Checks["redis"] != "down" {
|
||||
t.Fatalf("unexpected checks: %#v", result.Checks)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user