Test that files get deleted from Riak CS

This commit is contained in:
Garret Alfert 2013-10-10 14:57:10 +02:00
parent b12df5470f
commit e5dfbff82d
2 changed files with 15 additions and 4 deletions

View File

@ -428,10 +428,8 @@ describe "App with Riak backend" do
it "removes the binary object" do
last_response.status.must_equal 204
skip "check if object is removed from Riak CS"
# lambda {
# binary_bucket.get("jimmy:documents:jaypeg")
# }.must_raise Riak::HTTPFailedRequest
binary = cs_binary_bucket.files.get("jimmy:documents:jaypeg")
binary.must_be_nil
end
it "logs the operation" do

View File

@ -77,6 +77,19 @@ if app.settings.riak
end
end
def cs_client
@cs_client ||= Fog::Storage.new({
:provider => 'AWS',
:aws_access_key_id => app.settings.riak['riak_cs']['access_key'],
:aws_secret_access_key => app.settings.riak['riak_cs']['secret_key'],
:endpoint => app.settings.riak['riak_cs']['endpoint']
})
end
def cs_binary_bucket
@cs_binary_bucket ||= cs_client.directories.create(:key => app.settings.riak['buckets']['cs_binaries'])
end
def purge_all_buckets
[data_bucket, directory_bucket, auth_bucket, binary_bucket, opslog_bucket].each do |bucket|
bucket.keys.each {|key| bucket.delete key}