mirror of
https://github.com/coollabsio/coolify.git
synced 2026-10-29 10:04:36 +08:00
- On cloud, RestartService and RestartServiceApplication now run on the deployments queue instead of high. - StartProxy and RestartProxyJob, and the remote processes they start, now run on the deployments queue. - Self-hosted still uses the high queue. - Tests cover the new routing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
103 lines
3.3 KiB
PHP
103 lines
3.3 KiB
PHP
<?php
|
|
|
|
use App\Actions\Database\RestartDatabase;
|
|
use App\Actions\Database\StartDatabase;
|
|
use App\Actions\Database\StartDatabaseProxy;
|
|
use App\Actions\Proxy\StartProxy;
|
|
use App\Actions\Service\RestartService;
|
|
use App\Actions\Service\RestartServiceApplication;
|
|
use App\Actions\Service\StartService;
|
|
use App\Jobs\DatabaseBackupJob;
|
|
use App\Jobs\RestartProxyJob;
|
|
use App\Jobs\ScheduledJobManager;
|
|
use App\Models\ScheduledDatabaseBackup;
|
|
use App\Models\Server;
|
|
|
|
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');
|
|
});
|
|
});
|
|
|
|
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');
|
|
});
|
|
});
|
|
|
|
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,
|
|
RestartDatabase::class,
|
|
StartDatabaseProxy::class,
|
|
StartService::class,
|
|
RestartService::class,
|
|
RestartServiceApplication::class,
|
|
StartProxy::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,
|
|
RestartDatabase::class,
|
|
StartDatabaseProxy::class,
|
|
StartService::class,
|
|
RestartService::class,
|
|
RestartServiceApplication::class,
|
|
StartProxy::class,
|
|
]);
|
|
});
|
|
|
|
describe('proxy restart job routing', function () {
|
|
test('routes to the deployments queue on cloud', function () {
|
|
config(['constants.coolify.self_hosted' => false]);
|
|
|
|
expect((new RestartProxyJob(new Server))->queue)->toBe('deployments');
|
|
});
|
|
|
|
test('routes to the high queue on self-hosted', function () {
|
|
config(['constants.coolify.self_hosted' => true]);
|
|
|
|
expect((new RestartProxyJob(new Server))->queue)->toBe('high');
|
|
});
|
|
});
|
|
|
|
describe('scheduled job routing', function () {
|
|
test('scheduled jobs use the crons queue on cloud', function () {
|
|
config(['constants.coolify.self_hosted' => false]);
|
|
|
|
expect((new ScheduledJobManager)->queue)->toBe('crons');
|
|
expect((new DatabaseBackupJob(new ScheduledDatabaseBackup))->queue)->toBe('crons');
|
|
});
|
|
|
|
test('scheduled jobs use the high queue on self-hosted', function () {
|
|
config(['constants.coolify.self_hosted' => true]);
|
|
|
|
expect((new ScheduledJobManager)->queue)->toBe('high');
|
|
expect((new DatabaseBackupJob(new ScheduledDatabaseBackup))->queue)->toBe('high');
|
|
});
|
|
});
|