mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 21:18:11 -04:00
fix(applications): ignore missing health on additional server status
Closes #11892 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d60d3a5b9d
commit
3414b88e0d
@@ -971,11 +971,11 @@ class Application extends BaseModel
|
||||
$additional_servers_status = $this->additional_servers->pluck('pivot.status');
|
||||
foreach ($additional_servers_status as $status) {
|
||||
$server_status = str($status)->before(':')->value();
|
||||
$server_health = str($status)->after(':')->value() ?? 'unhealthy';
|
||||
$server_health = str($status)->contains(':') ? str($status)->after(':')->value() : null;
|
||||
if ($main_server_status !== $server_status) {
|
||||
$complex_status = 'degraded';
|
||||
}
|
||||
if ($main_server_health !== $server_health) {
|
||||
if ($server_health !== null && $main_server_health !== $server_health) {
|
||||
$complex_health = 'unhealthy';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Application;
|
||||
|
||||
function applicationWithAdditionalServerStatuses(string $mainStatus, array $additionalStatuses): Application
|
||||
{
|
||||
$application = new Application;
|
||||
$application->setRawAttributes(['status' => $mainStatus]);
|
||||
$application->setRelation('additional_servers', collect($additionalStatuses)
|
||||
->map(fn (string $status) => (object) ['pivot' => (object) ['status' => $status]]));
|
||||
|
||||
return $application;
|
||||
}
|
||||
|
||||
it('stays healthy when an additional server status has no health segment', function () {
|
||||
expect(applicationWithAdditionalServerStatuses('running:healthy', ['running'])->status)
|
||||
->toBe('running:healthy');
|
||||
});
|
||||
|
||||
it('reports unhealthy when an additional server has an explicit unhealthy status', function () {
|
||||
expect(applicationWithAdditionalServerStatuses('running:healthy', ['running:unhealthy'])->status)
|
||||
->toBe('running:unhealthy');
|
||||
});
|
||||
|
||||
it('reports degraded when an additional server status without health differs', function () {
|
||||
expect(applicationWithAdditionalServerStatuses('running:healthy', ['exited'])->status)
|
||||
->toBe('degraded:healthy');
|
||||
});
|
||||
Reference in New Issue
Block a user