diff options
author | Morris Jobke <hey@morrisjobke.de> | 2021-03-17 20:09:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-17 20:09:50 +0100 |
commit | c1c377f6095e9bd4e74d20ccaa81571abe939fa7 (patch) | |
tree | 0877d750306a464cdee0c448a03a7e219d037018 /tests/lib/Files | |
parent | a70bdb962b224a075c85f52839b349ed238141cf (diff) | |
parent | 6308267affdb993b48efeb0604a99c987ae724fd (diff) | |
download | nextcloud-server-c1c377f6095e9bd4e74d20ccaa81571abe939fa7.tar.gz nextcloud-server-c1c377f6095e9bd4e74d20ccaa81571abe939fa7.zip |
Merge pull request #26090 from nextcloud/backport/25722/stable21
[stable21] apply object store copy optimization when 'cross storage' copy is wit…
Diffstat (limited to 'tests/lib/Files')
-rw-r--r-- | tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php | 24 |
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')); + } } |