tweaking tests and error handling

This commit is contained in:
Kyle Rames 2013-01-14 08:36:21 -06:00
parent f034381cef
commit f2a8b35b30
3 changed files with 6 additions and 3 deletions

View File

@ -148,7 +148,7 @@ module Fog
def ready?(ready_state = ACTIVE, error_states=[ERROR])
if error_states
error_states = Array(error_states)
raise "ERROR: Server is in error State '#{state}'" if error_states.include?(state)
raise "Server should have transitioned to '#{ready_state}' not '#{state}'" if error_states.include?(state)
end
state == ready_state
end

View File

@ -28,7 +28,8 @@ module Shindo
until current_state == state
current_state = service.get_server(server_id).body['server']['status']
if error_states
raise "Error occurred! Server should have transitioned to '#{state}' not '#{current_state}'" if Array(error_states).include?(current_state)
error_states = Array(error_states)
raise "ERROR! Server should have transitioned to '#{state}' not '#{current_state}'" if error_states.include?(current_state)
end
sleep 10
end

View File

@ -66,6 +66,8 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server_tests', ['rackspace']) do
server_id = body['server']['id']
body
end
wait_for_server_state(service, server_id, 'ACTIVE', 'ERROR')
tests('#list_servers').formats(LIST_SERVERS_FORMAT, false) do
service.list_servers.body
@ -98,7 +100,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server_tests', ['rackspace']) do
service.rebuild_server(server_id, rebuild_image_id)
end
wait_for_server_state(service, server_id, 'ACTIVE', 'ERROR')
sleep 60
sleep 120
tests('#resize_server').succeeds do
resize_flavor_id = 3 # 1GB