Skip to content

Commit

Permalink
Merge pull request #579 from cloudfoundry/dav-client-inconsistent
Browse files Browse the repository at this point in the history
Should not fail if target to be deleted is already gone
  • Loading branch information
wendorf committed Apr 19, 2016
2 parents 214b78e + d61f59b commit d6f8c50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 3 additions & 1 deletion lib/cloud_controller/blobstore/webdav/dav_client.rb
Expand Up @@ -158,7 +158,9 @@ def delete_all_in_path(path)
response = with_error_handling { @client.delete(url, header: @headers) }
return if response.status == 204

raise FileNotFound.new("Could not find object '#{URI(url).path}', #{response.status}/#{response.content}") if response.status == 404
# requesting to delete something which is already gone is ok
return if response.status == 404

raise BlobstoreError.new("Could not delete all in path, #{response.status}/#{response.content}")
end

Expand Down
Expand Up @@ -555,11 +555,9 @@ module Blobstore
expect(httpclient).to have_received(:delete).with('http://localhost/admin/droplets/buildpack_cache/fo/ob/foobar/', header: {})
end

it 'raises FileNotfound when the server returns 404' do
it 'does not fail when the collection does not exist' do
allow(httpclient).to receive(:delete).and_return(instance_double(HTTP::Message, status: 404, content: ''))
expect {
client.delete_all_in_path('foobar')
}.to raise_error(FileNotFound, /Could not find object/)
client.delete_all_in_path('foobar')
expect(httpclient).to have_received(:delete).with('http://localhost/admin/droplets/buildpack_cache/fo/ob/foobar/', header: {})
end

Expand Down

0 comments on commit d6f8c50

Please sign in to comment.