mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 21:20:29 +00:00
feat(DatabaseBackupJob, ScheduledTaskJob): enforce minimum timeout and add execution ID for timeout handling
This commit is contained in:
@@ -45,6 +45,7 @@ it('DatabaseBackupJob has correct retry properties defined', function () {
|
||||
// Check public properties exist
|
||||
expect($reflection->hasProperty('tries'))->toBeTrue()
|
||||
->and($reflection->hasProperty('maxExceptions'))->toBeTrue()
|
||||
->and($reflection->hasProperty('timeout'))->toBeTrue()
|
||||
->and($reflection->hasMethod('backoff'))->toBeTrue()
|
||||
->and($reflection->hasMethod('failed'))->toBeTrue();
|
||||
|
||||
@@ -52,5 +53,25 @@ it('DatabaseBackupJob has correct retry properties defined', function () {
|
||||
$defaultProperties = $reflection->getDefaultProperties();
|
||||
|
||||
expect($defaultProperties['tries'])->toBe(2)
|
||||
->and($defaultProperties['maxExceptions'])->toBe(1);
|
||||
->and($defaultProperties['maxExceptions'])->toBe(1)
|
||||
->and($defaultProperties['timeout'])->toBe(3600);
|
||||
});
|
||||
|
||||
it('DatabaseBackupJob enforces minimum timeout of 60 seconds', function () {
|
||||
// Read the constructor to verify minimum timeout enforcement
|
||||
$reflection = new ReflectionClass(DatabaseBackupJob::class);
|
||||
$constructor = $reflection->getMethod('__construct');
|
||||
|
||||
// Get the constructor source
|
||||
$filename = $reflection->getFileName();
|
||||
$startLine = $constructor->getStartLine();
|
||||
$endLine = $constructor->getEndLine();
|
||||
|
||||
$source = file($filename);
|
||||
$constructorSource = implode('', array_slice($source, $startLine - 1, $endLine - $startLine + 1));
|
||||
|
||||
// Verify the implementation enforces minimum of 60 seconds
|
||||
expect($constructorSource)
|
||||
->toContain('max(')
|
||||
->toContain('60');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user