tests/rackspace/requests/compute_v2/attachment_tests.rb in gapinc-fog-1.12.1.1 vs tests/rackspace/requests/compute_v2/attachment_tests.rb in gapinc-fog-1.12.1.2
- old
+ new
@@ -1,11 +1,10 @@
Shindo.tests('Fog::Compute::RackspaceV2 | attachment_tests', ['rackspace']) do
compute_service = Fog::Compute::RackspaceV2.new
block_storage_service = Fog::Rackspace::BlockStorage.new
- image_id = Fog.credentials[:rackspace_image_id] || compute_service.images.first.id
- flavor_id = Fog.credentials[:rackspace_flavor_id] || compute_service.flavors.first.id
- timeout = Fog.mocking? ? 1 : 10
+ image_id = rackspace_test_image_id(compute_service)
+ flavor_id = rackspace_test_flavor_id(compute_service)
attachment_format = {
'volumeAttachment' => {
'id' => String,
'serverId' => String,
@@ -25,27 +24,27 @@
volume_id = block_storage_service.create_volume(100).body['volume']['id']
device_id = '/dev/xvde'
tests('success') do
- until compute_service.get_server(server_id).body['server']['status'] == 'ACTIVE'
- sleep timeout
+ wait_for_request("Waiting for server to become ready") do
+ compute_service.get_server(server_id).body['server']['status'] == 'ACTIVE'
end
- until block_storage_service.get_volume(volume_id).body['volume']['status'] == 'available'
- sleep timeout
+ wait_for_request("Waiting for Volume to be ready") do
+ block_storage_service.get_volume(volume_id).body['volume']['status'] == 'available'
end
tests("#attach_volume(#{server_id}, #{volume_id}, #{device_id})").formats(attachment_format) do
compute_service.attach_volume(server_id, volume_id, device_id).body
end
tests("#list_attachments(#{server_id})").formats(list_attachments_format) do
compute_service.list_attachments(server_id).body
end
- until block_storage_service.get_volume(volume_id).body['volume']['status'] == 'in-use'
- sleep timeout
+ wait_for_request("Waiting for Volume to be ready") do
+ block_storage_service.get_volume(volume_id).body['volume']['status'] == 'in-use'
end
tests("#get_attachment(#{server_id}, #{volume_id})").formats(attachment_format) do
compute_service.get_attachment(server_id, volume_id).body
end