mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 23:20:43 +00:00
fix: preserve unknown health status in Sentinel updates (PushServerUpdateJob)
## Problem Services with "running (unknown)" status were periodically changing to "running (healthy)" every ~30 seconds when Sentinel pushed updates. This was confusing for users and inconsistent with SSH-based status checks. ## Root Cause `PushServerUpdateJob::aggregateMultiContainerStatuses()` was missing logic to track "unknown" health state. It only tracked "unhealthy" and defaulted everything else to "healthy". When Sentinel pushed updates with "running (unknown)" containers: - The job saw `hasRunning = true` and `hasUnhealthy = false` - It incorrectly returned "running (healthy)" instead of "running (unknown)" ## Solution Updated `PushServerUpdateJob` to match the logic in `GetContainersStatus`: 1. Added `$hasUnknown` tracking variable 2. Check for "unknown" in status strings (alongside "unhealthy") 3. Implement 3-way priority: unhealthy > unknown > healthy This ensures consistency between: - SSH-based updates (`GetContainersStatus`) - Sentinel-based updates (`PushServerUpdateJob`) - UI display logic ## Changes - **app/Jobs/PushServerUpdateJob.php**: Added unknown status tracking - **tests/Unit/PushServerUpdateJobStatusAggregationTest.php**: New comprehensive tests - **tests/Unit/ExcludeFromHealthCheckTest.php**: Updated to match current implementation ## Testing All 31 status-related unit tests passing: - 18 tests in ContainerHealthStatusTest - 8 tests in ExcludeFromHealthCheckTest (updated) - 6 tests in PushServerUpdateJobStatusAggregationTest (new) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,9 @@ it('ensures ComplexStatusCheck returns excluded status when all containers exclu
|
||||
->toContain('// If all containers are excluded, calculate status from excluded containers')
|
||||
->toContain('// but mark it with :excluded to indicate monitoring is disabled')
|
||||
->toContain('if ($relevantContainerCount === 0) {')
|
||||
->toContain("return 'running:excluded';")
|
||||
->toContain("return 'running:unhealthy:excluded';")
|
||||
->toContain("return 'running:unknown:excluded';")
|
||||
->toContain("return 'running:healthy:excluded';")
|
||||
->toContain("return 'degraded:excluded';")
|
||||
->toContain("return 'exited:excluded';");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user