Full restore: say to run occ upgrade before rerunning a restore that stopped after the database; remove empty spool folders of a stopped restore

This commit is contained in:
2026-10-19 05:34:54 +02:00
parent 43a71684f9
commit 6121f684e9
5 changed files with 20 additions and 2 deletions
+9 -2
View File
@@ -41,8 +41,8 @@ class ReadAheadTest extends TestCase {
$this->snapshot = $repo->backupDirectory($this->src)['snapshot'];
}
private function restore(ReadAheadBackend $backend, string $prefix = ''): string {
$target = $this->tempDir();
private function restore(ReadAheadBackend $backend, string $prefix = '', ?string $target = null): string {
$target ??= $this->tempDir();
$repo = Repository::openWithKey($backend, $this->keys, null, null);
$repo->restore($this->snapshot, $target, $prefix);
return $target;
@@ -66,6 +66,13 @@ class ReadAheadTest extends TestCase {
$this->assertLessThanOrEqual(count($backend->inner->list('packs')) + 1, count($backend->asked));
}
public function testTheEmptySpoolOfAStoppedRestoreIsRemoved(): void {
$target = $this->tempDir();
mkdir("$target/.ngb-restore-spool-0badc0de", 0700); // a restore that was killed
$this->assertRestored($this->restore(new ReadAheadBackend(new LocalBackend($this->root)), '', $target));
}
public function testARangeThatCouldNotBeReadAheadIsReadTheUsualWay(): void {
$backend = new ReadAheadBackend(new LocalBackend($this->root), fail: [1]);