mirror of
				https://github.com/fog/fog.git
				synced 2022-11-09 13:51:43 -05:00 
			
		
		
		
	[ibm] Set a longer timeout on all wait_for calls
This commit is contained in:
		
							parent
							
								
									1b900b68b2
								
							
						
					
					
						commit
						92f39c8ea9
					
				
					 9 changed files with 22 additions and 15 deletions
				
			
		|  | @ -8,6 +8,10 @@ module Fog | |||
|     service(:compute, 'ibm/compute', 'Compute') | ||||
|     service(:storage, 'ibm/storage', 'Storage') | ||||
| 
 | ||||
|     # Provisioning is very slow. We'll pass this arg explicitly until there's a way | ||||
|     # to set the default timeout on a per-provider basis. | ||||
|     TIMEOUT = 1800 | ||||
| 
 | ||||
|     class Connection < Fog::Connection | ||||
| 
 | ||||
|       ENDPOINT = 'https://www-147.ibm.com/computecloud/enterprise/api/rest/20100331' | ||||
|  |  | |||
|  | @ -104,7 +104,7 @@ module Fog | |||
|           requires :location_id | ||||
|           new_ip = connection.addresses.new(:location => location_id) | ||||
|           new_ip.save | ||||
|           new_ip.wait_for { ready? } if wait_for_ready | ||||
|           new_ip.wait_for(Fog::IBM::TIMEOUT) { ready? } if wait_for_ready | ||||
|           secondary_ip << new_ip | ||||
|           new_ip | ||||
|         end | ||||
|  |  | |||
|  | @ -32,7 +32,7 @@ Shindo.tests('Fog::Compute[:ibm] | server', ['ibm']) do | |||
| 
 | ||||
|     tests('Fog::Compute::IBM::Server#wait_for { ready? }') do | ||||
|       @server = Fog::Compute[:ibm].servers.get(@instance_id) | ||||
|       @server.wait_for { ready? } | ||||
|       @server.wait_for(Fog::IBM::TIMEOUT) { ready? } | ||||
|     end | ||||
| 
 | ||||
|     tests('Fog::Compute::IBM::Server#id') do | ||||
|  | @ -66,9 +66,11 @@ Shindo.tests('Fog::Compute[:ibm] | server', ['ibm']) do | |||
|       body = @server.to_image(:name => @server.name) | ||||
|       returns(@server.name) { body['name'] } | ||||
|       image = Fog::Compute[:ibm].images.get(body['id']) | ||||
|       image.wait_for { ready? || state == 'New' } | ||||
|       image.wait_for(Fog::IBM::TIMEOUT) { ready? || state == 'New' } | ||||
|       unless image.state == 'Capturing' | ||||
|         returns(true) { Fog::Compute[:ibm].delete_image(image.id).body['success'] } | ||||
|       end | ||||
|     end | ||||
| 
 | ||||
|     tests('Fog::Compute::IBM::Server#expire_at') do | ||||
|       returns(true) { @server.expire_at(Time.now + 60) } | ||||
|  | @ -78,7 +80,7 @@ Shindo.tests('Fog::Compute[:ibm] | server', ['ibm']) do | |||
|       returns(true) { @server.destroy } | ||||
|     end | ||||
| 
 | ||||
|     @key.wait_for { instance_ids.empty? } | ||||
|     @key.wait_for(Fog::IBM::TIMEOUT) { instance_ids.empty? } | ||||
|     @key.destroy | ||||
| 
 | ||||
|   end | ||||
|  |  | |||
|  | @ -21,9 +21,9 @@ Shindo.tests('Fog::Compute[:ibm] | servers', ['ibm']) do | |||
|       returns(@instance_id) { @server.id } | ||||
|     end | ||||
| 
 | ||||
|     @server.wait_for { ready? } | ||||
|     @server.wait_for(Fog::IBM::TIMEOUT) { ready? } | ||||
|     @server.destroy | ||||
|     @key.wait_for { instance_ids.empty? } | ||||
|     @key.wait_for(Fog::IBM::TIMEOUT) { instance_ids.empty? } | ||||
|     @key.destroy | ||||
| 
 | ||||
|   end | ||||
|  |  | |||
|  | @ -24,7 +24,7 @@ Shindo.tests('Fog::Storage[:ibm] | volume', ['ibm']) do | |||
|     tests('Fog::Storage::IBM::Volume#save') do | ||||
|       returns(true)   { @volume.save } | ||||
|       returns(String) { @volume.id.class } | ||||
|       @volume.wait_for { ready? } | ||||
|       @volume.wait_for(Fog::IBM::TIMEOUT) { ready? } | ||||
|       @volume_id = @volume.id | ||||
|     end | ||||
| 
 | ||||
|  |  | |||
|  | @ -35,7 +35,7 @@ Shindo.tests('Fog::Compute[:ibm] | address requests', ['ibm']) do | |||
|     end | ||||
| 
 | ||||
|     tests("#delete_address('#{@address_id}')") do | ||||
|       Fog::Compute[:ibm].addresses.get(@address_id).wait_for { ready? } | ||||
|       Fog::Compute[:ibm].addresses.get(@address_id).wait_for(Fog::IBM::TIMEOUT) { ready? } | ||||
|       returns(true) { Fog::Compute[:ibm].delete_address(@address_id).body['success'] } | ||||
|     end | ||||
| 
 | ||||
|  |  | |||
|  | @ -80,7 +80,7 @@ Shindo.tests('Fog::Compute[:ibm] | image requests', ['ibm']) do | |||
|         :key_name => @key_name | ||||
|       ).body | ||||
|       @instance_id  = response['instances'][0]['id'] | ||||
|       Fog::Compute[:ibm].servers.get(@instance_id).wait_for(1200) { ready? } | ||||
|       Fog::Compute[:ibm].servers.get(@instance_id).wait_for(Fog::IBM::TIMEOUT) { ready? } | ||||
|       data          = Fog::Compute[:ibm].create_image(@instance_id, @image_name, "").body | ||||
|       @id           = data['id'] | ||||
|       data | ||||
|  | @ -98,7 +98,7 @@ Shindo.tests('Fog::Compute[:ibm] | image requests', ['ibm']) do | |||
|       returns(true) { Fog::Compute[:ibm].delete_image(@cloned_id).body['success'] } | ||||
|     end | ||||
| 
 | ||||
|     @key.wait_for { instance_ids.empty? } | ||||
|     @key.wait_for(Fog::IBM::TIMEOUT) { instance_ids.empty? } | ||||
|     @key.destroy | ||||
| 
 | ||||
|   end | ||||
|  |  | |||
|  | @ -54,7 +54,7 @@ Shindo.tests('Fog::Compute[:ibm] | instance requests', ['ibm']) do | |||
|       response = Fog::Compute[:ibm].get_instance(@instance_id).body | ||||
|     end | ||||
| 
 | ||||
|     Fog::Compute[:ibm].servers.get(@instance_id).wait_for { ready? } | ||||
|     Fog::Compute[:ibm].servers.get(@instance_id).wait_for(Fog::IBM::TIMEOUT) { ready? } | ||||
| 
 | ||||
|     tests("#list_instances").formats(@instances_format) do | ||||
|       instances = Fog::Compute[:ibm].list_instances.body | ||||
|  | @ -72,12 +72,13 @@ Shindo.tests('Fog::Compute[:ibm] | instance requests', ['ibm']) do | |||
|       returns(@expiration_time) { Fog::Compute[:ibm].modify_instance(@instance_id, 'expirationTime' => @expiration_time).body["expirationTime"] } | ||||
|     end | ||||
| 
 | ||||
|     Fog::Compute[:ibm].servers.get(@instance_id).wait_for(Fog::IBM::TIMEOUT) { ready? } | ||||
| 
 | ||||
|     tests("#delete_instance('#{@instance_id}')") do | ||||
|       Fog::Compute[:ibm].servers.get(@instance_id).wait_for { ready? } | ||||
|       data = Fog::Compute[:ibm].delete_instance(@instance_id) | ||||
|     end | ||||
| 
 | ||||
|     @key.wait_for { instance_ids.empty? } | ||||
|     @key.wait_for(Fog::IBM::TIMEOUT) { instance_ids.empty? } | ||||
|     @key.destroy | ||||
| 
 | ||||
|   end | ||||
|  |  | |||
|  | @ -80,7 +80,7 @@ Shindo.tests('Fog::Storage[:ibm] | volume requests', ['ibm']) do | |||
|       returns(true) { Fog::Storage[:ibm].delete_volume(@volume_id).body['success'] } | ||||
|     end | ||||
| 
 | ||||
|     @key.wait_for { instance_ids.empty? } | ||||
|     @key.wait_for(Fog::IBM::TIMEOUT) { instance_ids.empty? } | ||||
|     @key.destroy | ||||
| 
 | ||||
|   end | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Decklin Foster
						Decklin Foster