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>
39 lines
1.3 KiB
PHP
39 lines
1.3 KiB
PHP
<?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();
|
|
});
|