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>2021-02-19 17:52:58 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2021-03-09 22:31:27 +0300
commitc87b1a50d908f0d99622d4c71534d47af1ab9218 (patch)
tree4677d4a808caa42d1179987536dad749041ecc6c /tests/lib/Files
parent5063745cace4a7ccf219a23eb1b7717d06406707 (diff)
apply object store copy optimization when 'cross storage' copy is within the same object store
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib/Files')
-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'));
+ }
}