Skip to content

Commit

Permalink
Handle case where do_volume_creation_check gets a nil from Fog
Browse files Browse the repository at this point in the history
  • Loading branch information
mansam committed Jul 31, 2017
1 parent b27e168 commit 9a3fc95
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def do_volume_creation_check(volumes_refs)
source.ext_management_system.with_provider_connection(:service => "volume") do |service|
volumes_refs.each do |volume_attrs|
next unless volume_attrs[:source_type] == "volume"
status = service.volumes.get(volume_attrs[:uuid]).status
status = service.volumes.get(volume_attrs[:uuid]).try(:status)
return false, status unless status == "available"
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,15 @@

expect(@task.do_volume_creation_check([pending_volume_attrs])).to eq true
end

it "check creation status - not found" do
pending_volume_attrs = {:source_type => "volume"}
service = double
allow(service).to receive_message_chain('volumes.get').and_return nil
allow(@task.source.ext_management_system).to receive(:with_provider_connection)\
.with(:service => 'volume').and_yield(service)

expect(@task.do_volume_creation_check([pending_volume_attrs])).to eq [false, nil]
end
end
end

0 comments on commit 9a3fc95

Please sign in to comment.