mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[rackspace|compute] made device an optional parameter in attach_volume method and request; split volume_attach and attachments into two different tests
This commit is contained in:
parent
7b6bcd481e
commit
19a70fd612
3 changed files with 9 additions and 6 deletions
|
@ -104,7 +104,7 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def attach_volume(volume, device)
|
||||
def attach_volume(volume, device=nil)
|
||||
requires :identity
|
||||
volume_id = volume.is_a?(String) ? volume : volume.id
|
||||
attachments.create(:server_id => identity, :volume_id => volume_id, :device => device)
|
||||
|
|
|
@ -5,11 +5,12 @@ module Fog
|
|||
def attach_volume(server_id, volume_id, device)
|
||||
data = {
|
||||
'volumeAttachment' => {
|
||||
'volumeId' => volume_id,
|
||||
'device' => device
|
||||
'volumeId' => volume_id
|
||||
}
|
||||
}
|
||||
|
||||
data['volumeAttachment']['device'] = device if device
|
||||
|
||||
request(
|
||||
:body => Fog::JSON.encode(data),
|
||||
:expects => [200],
|
||||
|
|
|
@ -64,12 +64,14 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
|
|||
begin
|
||||
@volume = cbs_service.volumes.create(:size => 100, :display_name => "fog-#{timestamp}")
|
||||
@volume.wait_for(timeout=1500) { ready? }
|
||||
tests('#attach_volume') do
|
||||
@instance.attach_volume(@volume, "/dev/xvdb")
|
||||
tests('#attach_volume').succeeds do
|
||||
@instance.attach_volume(@volume)
|
||||
end
|
||||
tests('#attachments').returns(true) do
|
||||
@instance.wait_for(timeout=1500) do
|
||||
!attachments.empty?
|
||||
end
|
||||
returns(true) { @instance.attachments.any? {|a| a.volume_id == @volume.id } }
|
||||
@instance.attachments.any? {|a| a.volume_id == @volume.id }
|
||||
end
|
||||
ensure
|
||||
@volume.wait_for(timeout=1500) { !attachments.empty? }
|
||||
|
|
Loading…
Add table
Reference in a new issue