mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 17:21:04 +00:00
feat(backup): enhance backup job with S3 upload handling and notifications
- Introduced a new notification class, BackupSuccessWithS3Warning, to alert users when local backups succeed but S3 uploads fail. - Updated DatabaseBackupJob to track local backup success and handle S3 upload errors, improving error reporting and user notifications. - Modified ScheduledDatabaseBackupExecution model to include a new s3_uploaded boolean field for tracking S3 upload status. - Adjusted views and validation logic to reflect changes in backup execution status and S3 handling. - Added tests to ensure the new s3_uploaded column is correctly implemented and validated.
This commit is contained in:
37
tests/Feature/DatabaseBackupJobTest.php
Normal file
37
tests/Feature/DatabaseBackupJobTest.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use App\Models\ScheduledDatabaseBackupExecution;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
test('scheduled_database_backup_executions table has s3_uploaded column', function () {
|
||||
expect(Schema::hasColumn('scheduled_database_backup_executions', 's3_uploaded'))->toBeTrue();
|
||||
});
|
||||
|
||||
test('s3_uploaded column is nullable', function () {
|
||||
$columns = Schema::getColumns('scheduled_database_backup_executions');
|
||||
$s3UploadedColumn = collect($columns)->firstWhere('name', 's3_uploaded');
|
||||
|
||||
expect($s3UploadedColumn)->not->toBeNull();
|
||||
expect($s3UploadedColumn['nullable'])->toBeTrue();
|
||||
});
|
||||
|
||||
test('scheduled database backup execution model casts s3_uploaded correctly', function () {
|
||||
$model = new ScheduledDatabaseBackupExecution;
|
||||
$casts = $model->getCasts();
|
||||
|
||||
expect($casts)->toHaveKey('s3_uploaded');
|
||||
expect($casts['s3_uploaded'])->toBe('boolean');
|
||||
});
|
||||
|
||||
test('scheduled database backup execution model casts storage deletion fields correctly', function () {
|
||||
$model = new ScheduledDatabaseBackupExecution;
|
||||
$casts = $model->getCasts();
|
||||
|
||||
expect($casts)->toHaveKey('local_storage_deleted');
|
||||
expect($casts['local_storage_deleted'])->toBe('boolean');
|
||||
expect($casts)->toHaveKey('s3_storage_deleted');
|
||||
expect($casts['s3_storage_deleted'])->toBe('boolean');
|
||||
});
|
||||
Reference in New Issue
Block a user