Files
coolify/tests/Feature/CleanupHelperContainersJobDedupTest.php
Andras Bacsai c681dc0d0e fix(queue): coalesce queued container status and helper cleanup jobs per server
Queued GetContainersStatus runs are unique per server until a worker
starts them, and CleanupHelperContainersJob locks per server instead of
class-wide. Add UniqueUntilProcessingJobDecorator for laravel-actions.
2026-10-03 21:25:00 +02:00

27 lines
771 B
PHP

<?php
use App\Jobs\CleanupHelperContainersJob;
use App\Models\Server;
use App\Models\Team;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Queue;
uses(RefreshDatabase::class);
beforeEach(function () {
Server::flushIdentityMap();
$this->team = Team::factory()->create();
});
it('queues one helper container cleanup per server', function () {
Queue::fake();
$first = Server::factory()->create(['team_id' => $this->team->id]);
$second = Server::factory()->create(['team_id' => $this->team->id]);
CleanupHelperContainersJob::dispatch($first);
CleanupHelperContainersJob::dispatch($second);
CleanupHelperContainersJob::dispatch($first);
Queue::assertPushed(CleanupHelperContainersJob::class, 2);
});