2026-05-22 16:11:24 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
use App\Actions\Database\StartDatabase;
|
|
|
|
|
use App\Actions\Database\StartDatabaseProxy;
|
|
|
|
|
use App\Actions\Service\StartService;
|
2026-05-22 16:26:15 +02:00
|
|
|
use App\Jobs\DatabaseBackupJob;
|
2026-05-22 16:11:24 +02:00
|
|
|
use App\Jobs\ScheduledJobManager;
|
2026-05-22 16:26:15 +02:00
|
|
|
use App\Models\ScheduledDatabaseBackup;
|
2026-05-22 16:11:24 +02:00
|
|
|
|
|
|
|
|
describe('deployment_queue helper', function () {
|
|
|
|
|
test('uses the high queue on self-hosted', function () {
|
|
|
|
|
config(['constants.coolify.self_hosted' => true]);
|
|
|
|
|
|
|
|
|
|
expect(deployment_queue())->toBe('high');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('uses the deployments queue on cloud', function () {
|
|
|
|
|
config(['constants.coolify.self_hosted' => false]);
|
|
|
|
|
|
|
|
|
|
expect(deployment_queue())->toBe('deployments');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2026-05-22 16:26:15 +02:00
|
|
|
describe('crons_queue helper', function () {
|
|
|
|
|
test('uses the high queue on self-hosted', function () {
|
|
|
|
|
config(['constants.coolify.self_hosted' => true]);
|
|
|
|
|
|
|
|
|
|
expect(crons_queue())->toBe('high');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('uses the crons queue on cloud', function () {
|
|
|
|
|
config(['constants.coolify.self_hosted' => false]);
|
|
|
|
|
|
|
|
|
|
expect(crons_queue())->toBe('crons');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2026-05-22 16:11:24 +02:00
|
|
|
describe('start action job routing', function () {
|
|
|
|
|
test('routes to the deployments queue on cloud', function (string $actionClass) {
|
|
|
|
|
config(['constants.coolify.self_hosted' => false]);
|
|
|
|
|
|
|
|
|
|
expect($actionClass::makeJob()->queue)->toBe('deployments');
|
|
|
|
|
})->with([
|
|
|
|
|
StartDatabase::class,
|
|
|
|
|
StartDatabaseProxy::class,
|
|
|
|
|
StartService::class,
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
test('routes to the high queue on self-hosted', function (string $actionClass) {
|
|
|
|
|
config(['constants.coolify.self_hosted' => true]);
|
|
|
|
|
|
|
|
|
|
expect($actionClass::makeJob()->queue)->toBe('high');
|
|
|
|
|
})->with([
|
|
|
|
|
StartDatabase::class,
|
|
|
|
|
StartDatabaseProxy::class,
|
|
|
|
|
StartService::class,
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
2026-05-22 16:26:15 +02:00
|
|
|
describe('scheduled job routing', function () {
|
|
|
|
|
test('scheduled jobs use the crons queue on cloud', function () {
|
2026-05-22 16:11:24 +02:00
|
|
|
config(['constants.coolify.self_hosted' => false]);
|
|
|
|
|
|
|
|
|
|
expect((new ScheduledJobManager)->queue)->toBe('crons');
|
2026-05-22 16:26:15 +02:00
|
|
|
expect((new DatabaseBackupJob(new ScheduledDatabaseBackup))->queue)->toBe('crons');
|
2026-05-22 16:11:24 +02:00
|
|
|
});
|
|
|
|
|
|
2026-05-22 16:26:15 +02:00
|
|
|
test('scheduled jobs use the high queue on self-hosted', function () {
|
2026-05-22 16:11:24 +02:00
|
|
|
config(['constants.coolify.self_hosted' => true]);
|
|
|
|
|
|
|
|
|
|
expect((new ScheduledJobManager)->queue)->toBe('high');
|
2026-05-22 16:26:15 +02:00
|
|
|
expect((new DatabaseBackupJob(new ScheduledDatabaseBackup))->queue)->toBe('high');
|
2026-05-22 16:11:24 +02:00
|
|
|
});
|
|
|
|
|
});
|