tests/rackspace/helper.rb in fog-maestrodev-1.15.0.20130927082724 vs tests/rackspace/helper.rb in fog-maestrodev-1.18.0.20131111203459

- old
+ new

@@ -1,5 +1,10 @@ +LINKS_FORMAT = [{ + 'href' => String, + 'rel' => String +}] + module Shindo class Tests unless Fog.mocking? Fog.timeout = 2000 @@ -47,20 +52,25 @@ def wait_for_server_state(service, server_id, state, error_states=nil) current_state = nil until current_state == state current_state = service.get_server(server_id).body['server']['status'] if error_states - error_states = Array(error_states) - raise "ERROR! Server should have transitioned to '#{state}' not '#{current_state}'" if error_states.include?(current_state) + error_states = Array(error_states) + if error_states.include?(current_state) + Fog::Logger.warning caller + Fog::Logger.warning "ERROR! Server should have transitioned to '#{state}' not '#{current_state}'" + return + end end sleep 10 unless Fog.mocking? end sleep 30 unless Fog.mocking? end - def rackspace_test_image_id(service) + 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 - @image_id ||= Fog.credentials[:rackspace_image_id] || service.images.find {|img| img.name =~ /Ubuntu/ }.id + image_id ||= Fog.mocking? ? @service.images.first.id : @service.images.find {|image| image.name =~ /Ubuntu/}.id # use the first Ubuntu image end def rackspace_test_flavor_id(service) @flavor_id ||= Fog.credentials[:rackspace_flavor_id] || service.flavors.first.id end \ No newline at end of file