1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[rackspace] setting default fog timeout to 2000 for testing; removing specific hard coded timeouts.

This commit is contained in:
Kyle Rames 2013-06-26 09:31:00 -05:00
parent 604b4a625f
commit bb7b39afd6
6 changed files with 32 additions and 26 deletions

View file

@ -1,6 +1,11 @@
module Shindo
class Tests
unless Fog.mocking?
Fog.timeout = 2000
Fog::Logger.warning "Setting default fog timeout to #{Fog.timeout} seconds"
end
def given_a_load_balancer_service(&block)
@service = Fog::Rackspace::LoadBalancers.new
instance_eval(&block)

View file

@ -4,7 +4,7 @@ Shindo.tests('Fog::Rackspace::BlockStorage | volume', ['rackspace']) do
options = { :display_name => "fog_#{Time.now.to_i.to_s}", :size => 100 }
model_tests(service.volumes, options, true) do
@instance.wait_for(timeout=1200) { ready? }
@instance.wait_for{ ready? }
tests('double save').raises(Fog::Rackspace::BlockStorage::IdentifierTaken) do
@instance.save
@ -18,7 +18,7 @@ Shindo.tests('Fog::Rackspace::BlockStorage | volume', ['rackspace']) do
tests('#snapshots').succeeds do
begin
snapshot = @instance.create_snapshot
snapshot.wait_for(timeout=1200) { ready? }
snapshot.wait_for { ready? }
returns(true) { @instance.snapshots.first.id == snapshot.id }
ensure

View file

@ -11,7 +11,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | metadata', ['rackspace']) do
:flavor_id => rackspace_test_flavor_id(service),
:image_id => rackspace_test_image_id(service))
@server.wait_for(timeout=1500) { ready? }
@server.wait_for { ready? }
tests('server') do
collection_tests(@server.metadata, {:key => 'my_key', :value => 'my_value'}) do
@ -21,7 +21,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | metadata', ['rackspace']) do
tests('image') do
@image = @server.create_image("fog_image_#{test_time}", :metadata => {:my_key => 'my_value'})
@image.wait_for(timeout = 1500) { ready? }
@image.wait_for { ready? }
tests("#all").succeeds do
pending if Fog.mocking? && !mocks_implemented
metadata = @image.metadata.all

View file

@ -66,7 +66,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
end
model_tests(service.servers, options, true) do
@instance.wait_for(timeout=1500) { ready? }
@instance.wait_for { ready? }
tests('#metadata[\'fog_test\']').returns('true') do
@instance.metadata['fog_test']
@ -93,13 +93,13 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
returns('REBOOT') { @instance.state }
end
@instance.wait_for(timeout=1500) { ready? }
@instance.wait_for { ready? }
tests('#reboot("HARD")').succeeds do
@instance.reboot('HARD')
returns('HARD_REBOOT') { @instance.state }
end
@instance.wait_for(timeout=1500) { ready? }
@instance.wait_for { ready? }
@test_image = nil
begin
tests('#create_image').succeeds do
@ -112,7 +112,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
end
sleep 30 unless Fog.mocking?
@instance.wait_for(timeout=1500) { ready? }
@instance.wait_for { ready? }
sleep 60 unless Fog.mocking?
tests('#rebuild').succeeds do
@instance.rebuild rackspace_test_image_id(service)
@ -120,7 +120,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
end
sleep 30 unless Fog.mocking?
@instance.wait_for(timeout=1500) { ready? }
@instance.wait_for { ready? }
sleep 60 unless Fog.mocking?
tests('#resize').succeeds do
@instance.resize(3)
@ -128,37 +128,37 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
end
sleep 30 unless Fog.mocking?
@instance.wait_for(timeout=1500) { ready?('VERIFY_RESIZE', ['ACTIVE', 'ERROR']) }
@instance.wait_for { ready?('VERIFY_RESIZE', ['ACTIVE', 'ERROR']) }
sleep 60 unless Fog.mocking?
tests('#confirm_resize').succeeds do
@instance.confirm_resize
end
sleep 30 unless Fog.mocking?
@instance.wait_for(timeout=1500) { ready? }
@instance.wait_for { ready? }
sleep 60 unless Fog.mocking?
tests('#resize').succeeds do
@instance.resize(2)
returns('RESIZE') { @instance.state }
end
@instance.wait_for(timeout=1500) { ready?('VERIFY_RESIZE') }
@instance.wait_for { ready?('VERIFY_RESIZE') }
sleep 60 unless Fog.mocking?
tests('#revert_resize').succeeds do
@instance.revert_resize
end
@instance.wait_for(timeout=1500) { ready? }
@instance.wait_for { ready? }
tests('#rescue').succeeds do
@instance.rescue
end
@instance.wait_for(timeout=1500) { ready?('RESCUE') }
@instance.wait_for { ready?('RESCUE') }
tests('#unrescue').succeeds do
@instance.unrescue
end
@instance.wait_for(timeout=1500) { ready? }
@instance.wait_for { ready? }
tests('#change_admin_password').succeeds do
@instance.change_admin_password('somerandompassword')
returns('PASSWORD') { @instance.state }
@ -168,28 +168,29 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
tests('attachments') do
begin
@volume = cbs_service.volumes.create(:size => 100, :display_name => "fog-#{Time.now.to_i.to_s}")
@volume.wait_for(timeout=1500) { ready? }
@volume.wait_for { ready? }
tests('#attach_volume').succeeds do
@instance.attach_volume(@volume)
end
tests('#attachments').returns(true) do
@instance.wait_for(timeout=1500) do
@instance.wait_for do
!attachments.empty?
end
@instance.attachments.any? {|a| a.volume_id == @volume.id }
end
ensure
@volume.wait_for(timeout=1500) { !attachments.empty? }
@volume.wait_for { !attachments.empty? }
@instance.attachments.each {|a| a.detach }
@volume.wait_for(timeout=1500) { ready? && attachments.empty? }
@volume.wait_for { ready? && attachments.empty? }
@volume.destroy if @volume
end
end
@instance.wait_for(timeout=1500) { ready? }
@instance.wait_for { ready? }
end
wait_for_server_deletion(@instance)
sleep 60 unless Fog.mocking?
tests("delete network #{@network.label}").succeeds do
@network.destroy if @network
@ -197,17 +198,17 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
#When after testing resize/resize_confirm we get a 409 when we try to resize_revert so I am going to split it into two blocks
model_tests(service.servers, options, true) do
@instance.wait_for(timeout=1500) { ready? }
@instance.wait_for { ready? }
tests('#resize').succeeds do
@instance.resize(4)
returns('RESIZE') { @instance.state }
end
@instance.wait_for(timeout=1500) { ready?('VERIFY_RESIZE') }
@instance.wait_for { ready?('VERIFY_RESIZE') }
sleep 60 unless Fog.mocking?
tests('#revert_resize').succeeds do
@instance.revert_resize
end
@instance.wait_for(timeout=1500) { ready? }
@instance.wait_for { ready? }
end
end

View file

@ -5,7 +5,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | address requests', ['rackspace']) do
tests('success') do
unless Fog.mocking?
@server = @service.servers.create(:flavor_id => 2, :image_id => "8a3a9f96-b997-46fd-b7a8-a9e740796ffd", :name => "address-tests-#{Time.now.to_i}")
@server.wait_for(timeout=1200) { ready? }
@server.wait_for { ready? }
@server_id = @server.id
else
@server_id = 42

View file

@ -12,7 +12,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | metadata_tests', ['rackspace']) do
:flavor_id => 2,
:image_id => '3afe97b2-26dc-49c5-a2cc-a2fc8d80c001',
:metadata => metadata)
@server.wait_for(timeout = 1500) { ready? }
@server.wait_for { ready? }
@server_id = @server.id