mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[ec2] fix volume model mock specs and detach_volume mock
This commit is contained in:
parent
47893c5dd9
commit
30bf8ff90b
2 changed files with 11 additions and 5 deletions
|
@ -36,9 +36,9 @@ module Fog
|
|||
def detach_volume(volume_id, options = {})
|
||||
response = Excon::Response.new
|
||||
response.status = 200
|
||||
if volume = @data[:volumes][volume_id]
|
||||
if (volume = @data[:volumes][volume_id]) && !volume['attachmentSet'].empty?
|
||||
data = volume['attachmentSet'].pop
|
||||
@data[:volumes][volume_id]['status'] = 'available'
|
||||
volume['status'] = 'available'
|
||||
response.status = 200
|
||||
response.body = {
|
||||
'requestId' => Fog::AWS::Mock.request_id
|
||||
|
|
|
@ -46,14 +46,20 @@ describe 'Fog::AWS::EC2::Volume' do
|
|||
end
|
||||
|
||||
describe "#server=" do
|
||||
before(:each) do
|
||||
before(:all) do
|
||||
@server = AWS[:ec2].servers.create(:image_id => GENTOO_AMI)
|
||||
@volume = AWS[:ec2].volumes.new(:availability_zone => @server.availability_zone, :size => 1, :device => '/dev/sdz1')
|
||||
@server.wait_for { ready? }
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
after(:all) do
|
||||
@server.destroy
|
||||
end
|
||||
|
||||
before(:each) do
|
||||
@volume = AWS[:ec2].volumes.new(:availability_zone => @server.availability_zone, :size => 1, :device => '/dev/sdz1')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
if @volume.id
|
||||
@volume.wait_for { state == 'attached' }
|
||||
@volume.server = nil
|
||||
|
|
Loading…
Reference in a new issue