mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-04 18:52:49 +00:00
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Furox <177975472+Furox-Art@users.noreply.github.com> Co-authored-by: johandenhollander <johan.den.hollander@finalist.nl> Co-authored-by: João Cruz <161638790+SrJooJ@users.noreply.github.com> Co-authored-by: Saim Hashmi <hashmisaim037@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
29 lines
1.1 KiB
PHP
29 lines
1.1 KiB
PHP
<?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');
|
|
});
|