mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-04 10:42:23 +00:00
Check enabled volume backup schedules hourly and notify teams when no execution occurs within the configured number of days. Expose the alert threshold in the UI and API, with alerts disabled by default. Route volume backup results and warnings to the appropriate Telegram backup threads.
36 lines
1.3 KiB
PHP
36 lines
1.3 KiB
PHP
<?php
|
|
|
|
use App\Jobs\CheckMissingDatabaseBackupsJob;
|
|
use App\Jobs\CheckMissingVolumeBackupsJob;
|
|
use App\Jobs\CleanupInstanceStuffsJob;
|
|
use App\Jobs\CleanupOrphanedPreviewContainersJob;
|
|
use Illuminate\Support\Facades\Queue;
|
|
|
|
beforeEach(function () {
|
|
config()->set('cache.default', 'array');
|
|
Queue::fake();
|
|
});
|
|
|
|
dataset('scheduled instance jobs', [
|
|
'orphaned preview containers cleanup' => [CleanupOrphanedPreviewContainersJob::class, 600],
|
|
'instance cleanup' => [CleanupInstanceStuffsJob::class, 60],
|
|
'missing database backups check' => [CheckMissingDatabaseBackupsJob::class, 1800],
|
|
'missing volume backups check' => [CheckMissingVolumeBackupsJob::class, 1800],
|
|
]);
|
|
|
|
it('does not queue the job again while its unique lock is held', function (string $jobClass, int $lockSeconds) {
|
|
$jobClass::dispatch();
|
|
$this->travel($lockSeconds - 1)->seconds();
|
|
$jobClass::dispatch();
|
|
|
|
Queue::assertPushed($jobClass, 1);
|
|
})->with('scheduled instance jobs');
|
|
|
|
it('queues the job again after a unique lock left by a killed worker expires', function (string $jobClass, int $lockSeconds) {
|
|
$jobClass::dispatch();
|
|
$this->travel($lockSeconds + 1)->seconds();
|
|
$jobClass::dispatch();
|
|
|
|
Queue::assertPushed($jobClass, 2);
|
|
})->with('scheduled instance jobs');
|