diff --git a/mothership/internal/health/health.go b/mothership/internal/health/health.go index 980c214..e41f3dc 100644 --- a/mothership/internal/health/health.go +++ b/mothership/internal/health/health.go @@ -122,9 +122,9 @@ func (c *Checker) check(version string) Response { c.level3Since = time.Time{} } - // Condition 3: No nodes online after 5 minutes uptime + // Condition 3: No nodes online after 5 minutes uptime (informational only, + // does not degrade status — zero nodes is valid for headless deployments) if nodesOnline == 0 && uptime > 300 { - status = "degraded" if reason == "" { reason = "no nodes connected" } diff --git a/mothership/internal/health/health_test.go b/mothership/internal/health/health_test.go index a971563..3ec9490 100644 --- a/mothership/internal/health/health_test.go +++ b/mothership/internal/health/health_test.go @@ -72,7 +72,8 @@ func TestHealthCheckDBFailing(t *testing.T) { } } -// TestHealthCheckNoNodes tests that health check returns degraded after 5 min with no nodes. +// TestHealthCheckNoNodes tests that health check stays OK after 5 min with no nodes +// (zero nodes is valid for headless deployments). func TestHealthCheckNoNodes(t *testing.T) { checker := &Checker{ startTime: time.Now().Add(-6 * time.Minute), // 6 minutes ago @@ -88,8 +89,8 @@ func TestHealthCheckNoNodes(t *testing.T) { resp := checker.check("1.0.0") - if resp.Status != "degraded" { - t.Errorf("expected status=degraded, got %s", resp.Status) + if resp.Status != "ok" { + t.Errorf("expected status=ok, got %s", resp.Status) } if resp.Reason != "no nodes connected" { t.Errorf("expected reason='no nodes connected', got %s", resp.Reason)