Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2017-07-19 13:30:59 +0300
committerMorris Jobke <hey@morrisjobke.de>2017-07-21 15:06:13 +0300
commit06a4d6b5b9f82954c818de8d26b2a337d0f049e7 (patch)
tree896273dcd315caf1541f75ad50ea261720d17ad1 /tests/lib/Repair
parenta33b6cdd21868abf026375503a4eb5a36684c8eb (diff)
Also repair storage id's when repairing invalid entries
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib/Repair')
-rw-r--r--tests/lib/Repair/RepairInvalidPathsTest.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/lib/Repair/RepairInvalidPathsTest.php b/tests/lib/Repair/RepairInvalidPathsTest.php
index fe848b62073..b0370f5ae2d 100644
--- a/tests/lib/Repair/RepairInvalidPathsTest.php
+++ b/tests/lib/Repair/RepairInvalidPathsTest.php
@@ -36,6 +36,10 @@ class RepairInvalidPathsTest extends TestCase {
private $storage;
/** @var Cache */
private $cache;
+ /** @var Temporary */
+ private $storage2;
+ /** @var Cache */
+ private $cache2;
/** @var RepairInvalidPaths */
private $repair;
@@ -44,6 +48,8 @@ class RepairInvalidPathsTest extends TestCase {
$this->storage = new Temporary();
$this->cache = $this->storage->getCache();
+ $this->storage2 = new Temporary();
+ $this->cache2 = $this->storage2->getCache();
$config = $this->createMock(IConfig::class);
$config->expects($this->any())
->method('getSystemValue')
@@ -152,4 +158,32 @@ class RepairInvalidPathsTest extends TestCase {
$this->assertEquals($folderId1, $this->cache->getId('foo2/bar'));
$this->assertEquals($folderId2, $this->cache->getId('foo2/bar2'));
}
+
+ public function testRepairNonDuplicateBetweenStorage() {
+ $this->storage->mkdir('foo/bar/asd');
+ $this->storage2->mkdir('foo2');
+ $this->storage->getScanner()->scan('');
+ $this->storage2->getScanner()->scan('');
+
+ $folderId = $this->cache->getId('foo/bar');
+ $newParentEntry = $this->cache2->get('foo2');
+ $newParentFolderId = $newParentEntry->getId();
+ // failed rename, moved entry is updated but not it's children
+ $this->cache->update($folderId, ['path' => 'foo2/bar', 'parent' => $newParentFolderId, 'storage' => $newParentEntry->getStorageId()]);
+
+ $this->assertTrue($this->cache2->inCache('foo2/bar'));
+ $this->assertTrue($this->cache->inCache('foo/bar/asd'));
+ $this->assertFalse($this->cache2->inCache('foo2/bar/asd'));
+
+ $this->assertEquals($folderId, $this->cache->get('foo/bar/asd')['parent']);
+
+ $this->repair->run($this->createMock(IOutput::class));
+
+ $this->assertTrue($this->cache2->inCache('foo2/bar'));
+ $this->assertTrue($this->cache2->inCache('foo2/bar/asd'));
+ $this->assertFalse($this->cache->inCache('foo/bar/asd'));
+
+ $this->assertEquals($folderId, $this->cache2->get('foo2/bar/asd')['parent']);
+ $this->assertEquals($folderId, $this->cache2->getId('foo2/bar'));
+ }
}