Skip to content

Commit

Permalink
ensure it sends again after being paused
Browse files Browse the repository at this point in the history
  • Loading branch information
Nielsvanpach committed Jun 12, 2024
1 parent 0febe95 commit d554e4a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
12 changes: 12 additions & 0 deletions tests/Feature/Commands/MonitorBackupsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,15 @@

Event::assertNotDispatched(UnhealthySourceFoundEvent::class);
});

it('will send if the source is not paused anymore', function () {
Event::fake();

Source::factory()->create([
'paused_failed_notifications_until' => now()->subMinute(),
]);

$this->artisan('backup-server:monitor')->assertExitCode(0);

Event::assertDispatched(UnhealthySourceFoundEvent::class);
});
13 changes: 12 additions & 1 deletion tests/Feature/Tasks/Backup/Jobs/PerformBackupJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Storage;
use Spatie\BackupServer\Models\Backup;
use Spatie\BackupServer\Models\Source;
use Spatie\BackupServer\Tasks\Backup\Events\BackupFailedEvent;
Expand Down Expand Up @@ -117,3 +116,15 @@

Event::assertNotDispatched(BackupFailedEvent::class);
});

it('will create an event when the source is not paused anymore', function () {
Event::fake();

$this->source->update(['paused_failed_notifications_until' => now()->subMinute()]);

$this->artisan('backup-server:dispatch-backups')->assertExitCode(0);

$this->assertSame(Backup::STATUS_FAILED, $this->source->backups()->first()->status);

Event::assertDispatched(BackupFailedEvent::class);
});

0 comments on commit d554e4a

Please sign in to comment.