Without system cron: warning and a backup that moves on while the page is open (#13); progress of the database phase; Bin tab
- The admin page and backup:status warn when background jobs do not run on a
system cron, or the cron stopped, with a link to how to set one up.
- Without a working system cron, the open admin page moves a running backup
forward through /api/tick, a short step per poll.
- The database phase shows the tables dumped ("db: 47/183 tables"); a backup
that has not moved for 15 minutes says it is waiting for background jobs.
- The trash of restore points is on a tab of its own, Bin.
- New screenshots; changelog and plan for 1.0.2.
This commit is contained in:
@@ -24,4 +24,25 @@ class BackupProgressTest extends TestCase {
|
||||
$this->assertNull(BackupRun::progress(['phase' => 'files', 'estimate' => ['bytes' => 0, 'approximate' => true], 'stats' => ['bytes' => 1]]));
|
||||
$this->assertNull(BackupRun::progress(['phase' => 'commit', 'estimate' => ['bytes' => 10, 'approximate' => false], 'stats' => ['bytes' => 1]]));
|
||||
}
|
||||
|
||||
private static function runIn(string $phase, array $state, string $status = \OCA\NgBackup\Db\Run::RUNNING): \OCA\NgBackup\Db\Run {
|
||||
$run = new \OCA\NgBackup\Db\Run();
|
||||
$run->setStatus($status);
|
||||
$run->setPhase($phase);
|
||||
$run->setState(json_encode($state, JSON_THROW_ON_ERROR));
|
||||
return $run;
|
||||
}
|
||||
|
||||
public function testDatabasePhaseCountsTheTablesDumped(): void {
|
||||
$run = self::runIn('db', ['dump' => ['tables' => array_fill(0, 183, 'oc_t'), 'i' => 47]]);
|
||||
$this->assertSame(['fraction' => 47 / 183, 'approximate' => false, 'tables' => 47, 'totalTables' => 183], BackupRun::progressOf($run));
|
||||
}
|
||||
|
||||
public function testDatabasePhaseHasNoFigureBeforeItsFirstStep(): void {
|
||||
$this->assertNull(BackupRun::progressOf(self::runIn('db', ['files' => []])));
|
||||
}
|
||||
|
||||
public function testNoProgressForAFinishedRun(): void {
|
||||
$this->assertNull(BackupRun::progressOf(self::runIn('db', ['dump' => ['tables' => ['oc_a'], 'i' => 0]], \OCA\NgBackup\Db\Run::DONE)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user