deploy: Worker-Prüfung am Ende von deploy.sh — monitoring:queue-probe stellt einen Test-Job ein und wartet bis 60 s; ohne Worker Exit 3 mit Hinweis

Anlass 06.10.2026: Nach dem Deploy von v1.3.0 hat queue:restart den Worker
beendet, Supervisor lief nicht, über eine Stunde blieben KI-Prüfungen und
Mails liegen, ohne dass es auffiel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-10-06 16:11:58 +00:00
parent 06e37c9992
commit ce6e8b48e0
4 changed files with 136 additions and 0 deletions

View file

@ -0,0 +1,39 @@
<?php
use App\Jobs\Monitoring\QueueProbe;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Sleep;
/**
* Worker-Prüfung am Ende von deploy.sh (06.10.2026: Supervisor lief nicht,
* der Worker kam nach `queue:restart` nicht zurück, niemand merkte es).
*/
test('a running worker picks up the probe job', function () {
Sleep::fake();
$this->artisan('monitoring:queue-probe', ['--wait' => 30])
->expectsOutputToContain('Queue-Worker läuft (Test-Job nach 0 s abgeholt).')
->assertSuccessful();
Sleep::assertSleptTimes(0);
});
test('without a worker the probe fails after the waiting time with a hint', function () {
Sleep::fake();
Queue::fake();
$this->artisan('monitoring:queue-probe', ['--wait' => 5])
->expectsOutputToContain('Kein Queue-Worker hat den Test-Job innerhalb von 5 s abgeholt.')
->expectsOutputToContain('Worker in Ploi prüfen')
->assertFailed();
Queue::assertPushed(QueueProbe::class, fn (QueueProbe $job): bool => $job->queue === null);
Sleep::assertSleptTimes(5);
});
test('the probe job only acknowledges its own token', function () {
(new QueueProbe('abc'))->handle();
expect(cache()->has(QueueProbe::cacheKey('abc')))->toBeTrue()
->and(cache()->has(QueueProbe::cacheKey('xyz')))->toBeFalse();
});