Index: an empty listing is an error in checks and cleanups too; refresh() fetches only index files it has not loaded; full-restore CI on Nextcloud 35.0.0

This commit is contained in:
2026-10-19 22:13:26 +02:00
parent c37b26ea38
commit d504067cd8
3 changed files with 45 additions and 15 deletions
@@ -65,6 +65,27 @@ class IndexListingTest extends TestCase {
}
}
public function testACheckWithAnEmptyListingIsAnErrorNotEveryBlobMissing(): void {
$backend = new FlakyBackend(new LocalBackend($this->root));
$repo = Repository::openWithKey($backend, $this->keys);
$backend->emptyIndexListings = 1;
$this->expectException(BackendException::class);
$this->expectExceptionMessage('listed no index files');
$repo->verify($this->snapshot);
}
public function testRefreshingFetchesOnlyIndexFilesItHasNotLoaded(): void {
$backend = new FlakyBackend(new LocalBackend($this->root));
$repo = Repository::openWithKey($backend, $this->keys);
$index = (new \ReflectionProperty($repo, 'index'))->getValue($repo);
$index->downloaded = 0;
$index->refresh();
$this->assertSame(0, $index->downloaded, 'every index file is loaded already, also those whose blobs are elsewhere too');
}
public function testOpeningWithAnEmptyListingKeepsTheCachedIndex(): void {
$cache = new class implements IIndexCache {
public array $data = [];