mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[rackspace] making server tests more robust
This commit is contained in:
parent
40cfa73d79
commit
4df3e77e5e
2 changed files with 33 additions and 32 deletions
|
@ -65,25 +65,25 @@ module Shindo
|
|||
def rackspace_test_flavor_id(service)
|
||||
@flavor_id ||= Fog.credentials[:rackspace_flavor_id] || service.flavors.first.id
|
||||
end
|
||||
end
|
||||
|
||||
# After a server has been successfully deleted they are still being reported as attached to a cloud network
|
||||
# causing delete calls to fail. This method attempts to address that.
|
||||
def delete_test_network(network)
|
||||
return false if Fog.mocking? || network.nil?
|
||||
attempt = 0
|
||||
begin
|
||||
network.destroy
|
||||
rescue Fog::Compute::RackspaceV2::ServiceError => e
|
||||
if attempt == 3
|
||||
puts "Unable to delete #{network.label}"
|
||||
return false
|
||||
# After a server has been successfully deleted they are still being reported as attached to a cloud network
|
||||
# causing delete calls to fail. This method attempts to address that.
|
||||
def delete_test_network(network)
|
||||
return false if Fog.mocking? || network.nil?
|
||||
attempt = 0
|
||||
begin
|
||||
network.destroy
|
||||
rescue Fog::Compute::RackspaceV2::ServiceError => e
|
||||
if attempt == 3
|
||||
Fog::Logger.warning "Unable to delete #{network.label}"
|
||||
return false
|
||||
end
|
||||
Fog::Logger.warning "Network #{network.label} Delete Fail Attempt #{attempt}- #{e.inspect}"
|
||||
attempt += 1
|
||||
sleep 60
|
||||
retry
|
||||
end
|
||||
Fog.warning "Network #{network.label} Delete Fail Attempt #{attempt}- #{e.inspect}"
|
||||
attempt += 1
|
||||
sleep 60
|
||||
retry
|
||||
return true
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
|
@ -77,7 +77,8 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
|
|||
end
|
||||
|
||||
tests('#update').succeeds do
|
||||
@instance.name = "fog_server_update"
|
||||
new_name = "fog_server_update#{Time.now.to_i.to_s}"
|
||||
@instance.name = new_name
|
||||
@instance.access_ipv4_address= "10.10.0.1"
|
||||
@instance.access_ipv6_address= "::1"
|
||||
@instance.save
|
||||
|
@ -85,7 +86,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
|
|||
@instance.reload
|
||||
returns("10.10.0.1") { @instance.access_ipv4_address }
|
||||
returns("::1") { @instance.access_ipv6_address }
|
||||
returns("fog_server_update") { @instance.name }
|
||||
returns(new_name) { @instance.name }
|
||||
end
|
||||
|
||||
tests('#reboot("SOFT")').succeeds do
|
||||
|
@ -99,18 +100,6 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
|
|||
returns('HARD_REBOOT') { @instance.state }
|
||||
end
|
||||
|
||||
@instance.wait_for { ready? }
|
||||
@test_image = nil
|
||||
begin
|
||||
tests('#create_image').succeeds do
|
||||
@test_image = @instance.create_image('fog-test-image')
|
||||
@test_image.reload
|
||||
returns('SAVING') { @test_image.state }
|
||||
end
|
||||
ensure
|
||||
@test_image.destroy unless @test_image.nil? || Fog.mocking?
|
||||
end
|
||||
|
||||
sleep 30 unless Fog.mocking?
|
||||
@instance.wait_for { ready? }
|
||||
sleep 60 unless Fog.mocking?
|
||||
|
@ -165,6 +154,18 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
|
|||
returns('somerandompassword') { @instance.password }
|
||||
end
|
||||
|
||||
@instance.wait_for { ready? }
|
||||
@test_image = nil
|
||||
begin
|
||||
tests('#create_image').succeeds do
|
||||
@test_image = @instance.create_image('fog-test-image')
|
||||
@test_image.reload
|
||||
returns('SAVING') { @test_image.state }
|
||||
end
|
||||
ensure
|
||||
@test_image.destroy unless @test_image.nil? || Fog.mocking?
|
||||
end
|
||||
|
||||
tests('attachments') do
|
||||
begin
|
||||
@volume = cbs_service.volumes.create(:size => 100, :display_name => "fog-#{Time.now.to_i.to_s}")
|
||||
|
|
Loading…
Add table
Reference in a new issue