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

[openvz] Fixes #1871 test helper callback

This moves the setting up of an `at_exit` callback from when the file
is required to when the matching helper is used.

This prevents it failing on any run where OpenVZ is excluded.
This commit is contained in:
Paul Thornthwaite 2013-06-10 14:34:24 +01:00
parent 47216cc22e
commit 81fccc5ce5

View file

@ -18,6 +18,9 @@ def openvz_fog_test_server
# Server bootstrap took more than 120 secs! # Server bootstrap took more than 120 secs!
end end
end end
openvz_fog_test_cleanup
server server
end end
@ -27,15 +30,18 @@ def openvz_fog_test_server_destroy
server.destroy if server server.destroy if server
end end
at_exit do # Prepare a callback to destroy the long lived test server
unless Fog.mocking? def openvz_fog_test_cleanup
server = openvz_service.servers.find { |s| s.name == '104' } at_exit do
if server unless Fog.mocking?
server.wait_for(120) do server = openvz_service.servers.find { |s| s.name == '104' }
reload rescue nil; ready? if server
server.wait_for(120) do
reload rescue nil; ready?
end
end end
server.stop
openvz_fog_test_server_destroy
end end
server.stop
openvz_fog_test_server_destroy
end end
end end