mirror of
https://github.com/coollabsio/coolify.git
synced 2026-10-29 01:54:37 +08:00
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Furox <177975472+Furox-Art@users.noreply.github.com> Co-authored-by: johandenhollander <johan.den.hollander@finalist.nl> Co-authored-by: João Cruz <161638790+SrJooJ@users.noreply.github.com> Co-authored-by: Saim Hashmi <hashmisaim037@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
30 lines
1.2 KiB
PHP
30 lines
1.2 KiB
PHP
<?php
|
|
|
|
use App\Models\InstanceSettings;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('gives a new instance a random minute after midnight for auto updates', function () {
|
|
$settings = InstanceSettings::forceCreate(['id' => 0]);
|
|
|
|
expect($settings->fresh()->auto_update_frequency)->toMatch('/^([0-9]|[1-5][0-9]) 0 \* \* \*$/');
|
|
});
|
|
|
|
it('keeps an explicit auto update frequency on create', function () {
|
|
$settings = InstanceSettings::forceCreate(['id' => 0, 'auto_update_frequency' => '23 3 * * *']);
|
|
|
|
expect($settings->fresh()->auto_update_frequency)->toBe('23 3 * * *');
|
|
});
|
|
|
|
it('moves instances off the old midnight default and keeps custom schedules', function (string $frequency, string $expected) {
|
|
InstanceSettings::forceCreate(['id' => 0, 'auto_update_frequency' => $frequency]);
|
|
|
|
(require database_path('migrations/2026_10_15_213357_spread_default_auto_update_frequency.php'))->up();
|
|
|
|
expect(InstanceSettings::find(0)->auto_update_frequency)->toMatch($expected);
|
|
})->with([
|
|
'old default' => ['0 0 * * *', '/^([0-9]|[1-5][0-9]) 0 \* \* \*$/'],
|
|
'custom' => ['23 3 * * *', '/^23 3 \* \* \*$/'],
|
|
]);
|