summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2021-03-17 20:09:56 +0100
committerGitHub <noreply@github.com>2021-03-17 20:09:56 +0100
commit71b793f8a122fd8dce8ca26d2ecee51ac84799ec (patch)
treead7e98e296fcfd938607b01c96e6f636f0e75af2 /tests
parentc4da8d4e558be9a5155c681e0d4b395f4d9798ef (diff)
parent5827a156af8482eab65c6471aac96e7e375abcca (diff)
downloadnextcloud-server-71b793f8a122fd8dce8ca26d2ecee51ac84799ec.tar.gz
nextcloud-server-71b793f8a122fd8dce8ca26d2ecee51ac84799ec.zip
Merge pull request #26091 from nextcloud/backport/25722/stable20
[stable20] apply object store copy optimization when 'cross storage' copy is wit…
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php
index fa8ec535061..85a68be3daf 100644
--- a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php
+++ b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php
@@ -22,6 +22,7 @@ namespace Test\Files\ObjectStore;
use OC\Files\ObjectStore\StorageObjectStore;
use OC\Files\Storage\Temporary;
+use OC\Files\Storage\Wrapper\Jail;
use OCP\Files\ObjectStore\IObjectStore;
use Test\Files\Storage\Storage;
@@ -204,4 +205,27 @@ class ObjectStoreStorageTest extends Storage {
$this->assertTrue($cache->inCache('foo'));
$this->assertTrue($cache->inCache('foo/test.txt'));
}
+
+ public function testCopyBetweenJails() {
+ $this->instance->mkdir('a');
+ $this->instance->mkdir('b');
+ $jailA = new Jail([
+ 'storage' => $this->instance,
+ 'root' => 'a'
+ ]);
+ $jailB = new Jail([
+ 'storage' => $this->instance,
+ 'root' => 'b'
+ ]);
+ $jailA->mkdir('sub');
+ $jailA->file_put_contents('1.txt', '1');
+ $jailA->file_put_contents('sub/2.txt', '2');
+ $jailA->file_put_contents('sub/3.txt', '3');
+
+ $jailB->copyFromStorage($jailA, '', 'target');
+
+ $this->assertEquals('1', $this->instance->file_get_contents('b/target/1.txt'));
+ $this->assertEquals('2', $this->instance->file_get_contents('b/target/sub/2.txt'));
+ $this->assertEquals('3', $this->instance->file_get_contents('b/target/sub/3.txt'));
+ }
}