From 83a1fce1a3be983126bc77ebd84f715ac43ac22e Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Mon, 8 Jul 2013 15:25:49 +0200 Subject: make tests workable with Amazon S3 --- apps/files_external/tests/amazons3.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/apps/files_external/tests/amazons3.php b/apps/files_external/tests/amazons3.php index 06bf968b606..8dcd386341e 100644 --- a/apps/files_external/tests/amazons3.php +++ b/apps/files_external/tests/amazons3.php @@ -40,21 +40,28 @@ class AmazonS3 extends Storage { if ($this->instance) { $connection = $this->instance->getConnection(); - // 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'] + 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'] )); + + $connection->waitUntilBucketNotExists(array( + 'Bucket' => $this->config['amazons3']['bucket'] + )); } } } -- cgit v1.2.3