mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Wait for volumes to become available.
This commit is contained in:
parent
9a70adea0f
commit
29fb4d28de
2 changed files with 15 additions and 0 deletions
|
@ -60,6 +60,19 @@ module Shindo
|
|||
sleep 30 unless Fog.mocking?
|
||||
end
|
||||
|
||||
def wait_for_volume_state(service, volume_id, state)
|
||||
current_state = nil
|
||||
until current_state == state
|
||||
current_state = service.get_volume(volume_id).body['volume']['status']
|
||||
if current_state == 'error'
|
||||
Fog::Logger.warning caller
|
||||
Fog::Logger.warning "Volume is in an error state!"
|
||||
return
|
||||
end
|
||||
sleep 10 unless Fog.mocking?
|
||||
end
|
||||
end
|
||||
|
||||
def rackspace_test_image_id(service)
|
||||
image_id = Fog.credentials[:rackspace_image_id]
|
||||
# I chose to use the first Ubuntu because it will work with the smallest flavor and it doesn't require a license
|
||||
|
|
|
@ -56,6 +56,8 @@ Shindo.tests('Fog::Rackspace::BlockStorage | volume_tests', ['rackspace']) do
|
|||
|
||||
ids.each do |id|
|
||||
tests("#delete_volume(#{id})").succeeds do
|
||||
wait_for_volume_state(service, id, 'available')
|
||||
|
||||
service.delete_volume(id)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue