summaryrefslogtreecommitdiffstats
path: root/tests/lib/Files
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2018-01-24 17:22:05 +0100
committerRobin Appelman <robin@icewind.nl>2018-01-24 17:22:05 +0100
commit3499cbdb76d264353d3d9f358601694bc4aae956 (patch)
treed277eafa0c6e24bbbd91e84b017400b478cffb2b /tests/lib/Files
parent4537faa5dabdcb2f0b888baa5031e59099e52d6a (diff)
downloadnextcloud-server-3499cbdb76d264353d3d9f358601694bc4aae956.tar.gz
nextcloud-server-3499cbdb76d264353d3d9f358601694bc4aae956.zip
Use S3Client::upload instead of splitting single/multipart upload ourselves
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib/Files')
-rw-r--r--tests/lib/Files/ObjectStore/S3Test.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/lib/Files/ObjectStore/S3Test.php b/tests/lib/Files/ObjectStore/S3Test.php
index 14167656fb5..a54ade8fd08 100644
--- a/tests/lib/Files/ObjectStore/S3Test.php
+++ b/tests/lib/Files/ObjectStore/S3Test.php
@@ -24,8 +24,10 @@ namespace Test\Files\ObjectStore;
use OC\Files\ObjectStore\S3;
class MultiPartUploadS3 extends S3 {
- public function multiPartUpload($urn, $stream) {
- parent::multiPartUpload($urn, $stream);
+ function writeObject($urn, $stream) {
+ $this->getConnection()->upload($this->bucket, $urn, $stream, 'private', [
+ 'mup_threshold' => 1
+ ]);
}
}
@@ -39,13 +41,18 @@ class S3Test extends ObjectStoreTest {
$this->markTestSkipped('objectstore not configured for s3');
}
- return new MultiPartUploadS3($config['arguments']);
+ return new S3($config['arguments']);
}
public function testMultiPartUploader() {
- $s3 = $this->getInstance();
+ $config = \OC::$server->getConfig()->getSystemValue('objectstore');
+ if (!is_array($config) || $config['class'] !== 'OC\\Files\\ObjectStore\\S3') {
+ $this->markTestSkipped('objectstore not configured for s3');
+ }
+
+ $s3 = new MultiPartUploadS3($config['arguments']);
- $s3->multiPartUpload('multiparttest', fopen(__FILE__, 'r'));
+ $s3->writeObject('multiparttest', fopen(__FILE__, 'r'));
$result = $s3->readObject('multiparttest');