summaryrefslogtreecommitdiffstats
path: root/apps/files_external/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-07-22 11:40:28 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2013-07-22 11:40:28 +0200
commit7b28f5a82cbb201110304a5c908c19701240c0d7 (patch)
tree33852cdd1d3e7f944ee3b7ee636a80201b03f098 /apps/files_external/tests
parent5cba09e93153bc7f345a878b341fd4eed8bb635f (diff)
parent342a54bf7b31fe21362bac59cfa80a5d30ce9362 (diff)
downloadnextcloud-server-7b28f5a82cbb201110304a5c908c19701240c0d7.tar.gz
nextcloud-server-7b28f5a82cbb201110304a5c908c19701240c0d7.zip
Merge branch 'master' into ext-fs-irods-master
Diffstat (limited to 'apps/files_external/tests')
-rw-r--r--apps/files_external/tests/amazons3.php31
-rw-r--r--apps/files_external/tests/config.php8
2 files changed, 31 insertions, 8 deletions
diff --git a/apps/files_external/tests/amazons3.php b/apps/files_external/tests/amazons3.php
index 6b3a942b5ba..a73b6307b01 100644
--- a/apps/files_external/tests/amazons3.php
+++ b/apps/files_external/tests/amazons3.php
@@ -4,7 +4,9 @@
* ownCloud
*
* @author Michael Gapczynski
+ * @author Christian Berendt
* @copyright 2012 Michael Gapczynski mtgap@owncloud.com
+ * @copyright 2013 Christian Berendt berendt@b1-systems.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@@ -25,25 +27,40 @@ namespace Test\Files\Storage;
class AmazonS3 extends Storage {
private $config;
- private $id;
public function setUp() {
- $id = uniqid();
$this->config = include('files_external/tests/config.php');
if ( ! is_array($this->config) or ! isset($this->config['amazons3']) or ! $this->config['amazons3']['run']) {
$this->markTestSkipped('AmazonS3 backend not configured');
}
- $this->config['amazons3']['bucket'] = $id; // Make sure we have a new empty bucket to work in
$this->instance = new \OC\Files\Storage\AmazonS3($this->config['amazons3']);
}
public function tearDown() {
if ($this->instance) {
- $s3 = new \AmazonS3(array('key' => $this->config['amazons3']['key'],
- 'secret' => $this->config['amazons3']['secret']));
- if ($s3->delete_all_objects($this->id)) {
- $s3->delete_bucket($this->id);
+ $connection = $this->instance->getConnection();
+
+ try {
+ // NOTE(berendt): clearBucket() is not working with Ceph
+ $iterator = $connection->getIterator('ListObjects', array(
+ 'Bucket' => $this->config['amazons3']['bucket']
+ ));
+
+ foreach ($iterator as $object) {
+ $connection->deleteObject(array(
+ 'Bucket' => $this->config['amazons3']['bucket'],
+ 'Key' => $object['Key']
+ ));
+ }
+ } catch (S3Exception $e) {
}
+
+ $connection->deleteBucket(array(
+ 'Bucket' => $this->config['amazons3']['bucket']
+ ));
+
+ //wait some seconds for completing the replication
+ sleep(30);
}
}
}
diff --git a/apps/files_external/tests/config.php b/apps/files_external/tests/config.php
index bac594b485f..ca7bf50038f 100644
--- a/apps/files_external/tests/config.php
+++ b/apps/files_external/tests/config.php
@@ -50,7 +50,13 @@ return array(
'run'=>false,
'key'=>'test',
'secret'=>'test',
- 'bucket'=>'bucket',
+ 'bucket'=>'bucket'
+ //'hostname' => 'your.host.name',
+ //'port' => '443',
+ //'use_ssl' => 'true',
+ //'region' => 'eu-west-1',
+ //'test'=>'true',
+ //'timeout'=>20
),
'dropbox' => array (
'run'=>false,