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

Rectify issues with tests and status

* Since the server will remain in ACTIVE state for up to a few minutes, do not
  set the status (to prevent a situation where the state bounces between
  PREP_RESCUE and ACTIVE).
* Add format() test for the call to #rescue
* Remove extraneous sleep from the test against #unrescue
* Remove immediate tests for state.  Rather, depend upon the wait_for function.
This commit is contained in:
Chris Wuest 2013-04-15 16:01:44 -05:00
parent a1f0dbf428
commit b1e86c36b1
4 changed files with 7 additions and 5 deletions

View file

@ -467,7 +467,6 @@ module Fog
requires :identity
data = service.rescue_server(identity)
merge_attributes(data.body)
self.state = RESCUE
true
end

View file

@ -33,7 +33,9 @@ module Fog
def rescue_server(server_id)
server = self.data[:servers][server_id]
server["status"] = "RESCUE"
response(:status => 200)
admin_pass = Fog::Mock.random_letters(12)
server_response = { 'adminPass' => admin_pass }
response(:status => 200, :body => server_response)
end
end
end

View file

@ -142,11 +142,9 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
@instance.wait_for(timeout=1500) { ready? }
tests('#rescue').succeeds do
@instance.rescue
returns('RESCUE') { @instance.state }
end
@instance.wait_for(timeout=1500) { ready?('RESCUE') }
sleep 60 unless Fog.mocking?
tests('#unrescue').succeeds do
@instance.unrescue
end

View file

@ -54,6 +54,9 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server_tests', ['rackspace']) do
}
}
rescue_server_format = {
'adminPass' => Fog::Nullable::String
}
tests('success') do
@ -124,7 +127,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server_tests', ['rackspace']) do
end
wait_for_server_state(service, server_id, 'ACTIVE', 'ERROR')
tests('#rescue_server').succeeds do
tests('#rescue_server').formats(rescue_server_format, false) do
service.rescue_server(server_id)
end
wait_for_server_state(service, server_id, 'RESCUE', 'ACTIVE')