make tests workable with Amazon S3

This commit is contained in:
Christian Berendt 2013-07-08 15:25:49 +02:00
parent 882d5ad728
commit 83a1fce1a3

View file

@ -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']
));
}
}
}