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

[digitalocean|compute] Improved tests reliability

Better handling of power state related tests
This commit is contained in:
Sergio Rubio 2013-03-31 22:13:10 +02:00
parent e83fefd5c0
commit 7ee38ee2f6
3 changed files with 8 additions and 10 deletions

View file

@ -58,7 +58,9 @@ Shindo.tests("Fog::Compute[:digitalocean] | server model", ['digitalocean', 'com
server.ready? server.ready?
end end
# DigitalOcean shutdown is unreliable # DigitalOcean shutdown is unreliable
# so disable it in real mode for now
test('#shutdown') do test('#shutdown') do
pending unless Fog.mocking?
server.start server.start
server.wait_for { server.ready? } server.wait_for { server.ready? }
server.shutdown server.shutdown

View file

@ -13,9 +13,11 @@ Shindo.tests('Fog::Compute[:digitalocean] | create_server request', ['digitaloce
tests('success') do tests('success') do
tests('#create_server').formats({'status' => 'OK', 'droplet' => @server_format}) do tests('#create_server').formats({'status' => 'OK', 'droplet' => @server_format}) do
image = service.images.find { |img| img.name == 'Ubuntu 12.04 x64 Server' }
flavor = service.flavors.find { |f| f.name == '512MB' }
data = Fog::Compute[:digitalocean].create_server 'fog-test-server', data = Fog::Compute[:digitalocean].create_server 'fog-test-server',
service.flavors.first.id, flavor.id,
service.images.first.id, image.id,
service.regions.first.id service.regions.first.id
data.body data.body
end end

View file

@ -4,14 +4,8 @@ Shindo.tests('Fog::Compute[:digitalocean] | reboot_server request', ['digitaloce
tests('success') do tests('success') do
tests('#reboot_server') do tests('#reboot_server').succeeds do
test('returns 200') do service.reboot_server(server.id).body['status'] == 'OK'
service.reboot_server(server.id).status == 200
end
test('state is off') do
server.wait_for { server.state == 'off' }
server.state == 'off'
end
end end
end end