Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Test without parallel storages
  • Loading branch information
tomneedham committed Nov 1, 2017
commit 0409c06bda03e627fe0b2e940b8236b89d1828d8
12 changes: 10 additions & 2 deletions tests/lib/Repair/RepairMismatchFileCachePathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ public function testRepairDetachedSubtree() {
// end corrupt storage

// Parallel test storage
/*
$storageId_parallel = 2;
$rootId1_parallel = $this->createFileCacheEntry($storageId_parallel, '');
$baseId1_parallel = $this->createFileCacheEntry($storageId_parallel, 'files', $rootId1_parallel);
Expand All @@ -592,14 +593,15 @@ public function testRepairDetachedSubtree() {
$notOrphanedFolderChild2_parallel = $this->createFileCacheEntry($storageId_parallel, 'missingdir/missingdir1', $notOrphanedFolder2_parallel);
$notOrphanedId2_parallel = $this->createFileCacheEntry($storageId_parallel, 'missingdir/missingdir1/orphaned2', $notOrphanedFolder2_parallel);
// end parallel test storage
*/

$outputMock = $this->createMock(IOutput::class);
$this->repair->setStorageNumericId($storageId);
$this->repair->run($outputMock);

// orphaned entry reattached
$entry = $this->getFileCacheEntry($orphanedId1);
$this->assertEquals($nonExistingParentId, $entry['parent']);
$this->assertEquals($nonExistingParentId, $entry['parent']); // this row fails, $entry['parent'] seems to equal a similar but different value
$this->assertEquals((string)$storageId, $entry['storage']);
$this->assertEquals('files/missingdir/orphaned1', $entry['path']);
$this->assertEquals(md5('files/missingdir/orphaned1'), $entry['path_hash']);
Expand Down Expand Up @@ -640,6 +642,7 @@ public function testRepairDetachedSubtree() {
$this->assertEquals(md5(''), $entry['path_hash']);

// now check the parallel storage is intact
/*
// orphaned entry reattached
$entry = $this->getFileCacheEntry($notOrphanedId1_parallel);
$this->assertEquals($notOrphanedFolder_parallel, $entry['parent']);
Expand Down Expand Up @@ -681,6 +684,7 @@ public function testRepairDetachedSubtree() {
$this->assertEquals((string)$storageId_parallel, $entry['storage']);
$this->assertEquals('', $entry['path']);
$this->assertEquals(md5(''), $entry['path_hash']);
*/
}

/**
Expand All @@ -695,9 +699,11 @@ public function testRepairMissingRoot() {
$orphanedId = $this->createFileCacheEntry($storageId, 'noroot', $nonExistingParentId);

// Test parallel storage which should be untouched by the repair operation
/*
$testStorageId = 2;
$baseId = $this->createFileCacheEntry($testStorageId, '');
$noRootid = $this->createFileCacheEntry($testStorageId, 'noroot', $baseId);
*/


$outputMock = $this->createMock(IOutput::class);
Expand All @@ -713,11 +719,12 @@ public function testRepairMissingRoot() {

// recreated root entry
$entry = $this->getFileCacheEntry($entry['parent']);
$this->assertEquals(-1, $entry['parent']);
$this->assertEquals(-1, $entry['parent']); // this row fails, it appears to get attached to another entry, not the root (fileid ~ 4000)
$this->assertEquals((string)$storageId, $entry['storage']);
$this->assertEquals('', $entry['path']);
$this->assertEquals(md5(''), $entry['path_hash']);

/*
// Check that the parallel test storage is still intact
$entry = $this->getFileCacheEntry($noRootid);
$this->assertEquals($baseId, $entry['parent']);
Expand All @@ -729,6 +736,7 @@ public function testRepairMissingRoot() {
$this->assertEquals((string)$testStorageId, $entry['storage']);
$this->assertEquals('', $entry['path']);
$this->assertEquals(md5(''), $entry['path_hash']);
*/
}
}