mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Added server power cycle actions + basic tests.
TODO: More complex scenarios, edges cases, plus feedback tests for state following each power cycle action.
This commit is contained in:
parent
2f4ac6433e
commit
b670d5e719
5 changed files with 69 additions and 2 deletions
13
lib/fog/serverlove/requests/compute/reset_server.rb
Normal file
13
lib/fog/serverlove/requests/compute/reset_server.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class Serverlove
|
||||||
|
class Real
|
||||||
|
|
||||||
|
def reset_server(server_id)
|
||||||
|
request(:method => "post", :path => "/servers/#{server_id}/reset", :expects => 204)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
13
lib/fog/serverlove/requests/compute/shutdown_server.rb
Normal file
13
lib/fog/serverlove/requests/compute/shutdown_server.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class Serverlove
|
||||||
|
class Real
|
||||||
|
|
||||||
|
def shutdown_server(server_id)
|
||||||
|
request(:method => "post", :path => "/servers/#{server_id}/shutdown", :expects => 204)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
13
lib/fog/serverlove/requests/compute/start_server.rb
Normal file
13
lib/fog/serverlove/requests/compute/start_server.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class Serverlove
|
||||||
|
class Real
|
||||||
|
|
||||||
|
def start_server(server_id)
|
||||||
|
request(:method => "post", :path => "/servers/#{server_id}/start", :expects => 204)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
13
lib/fog/serverlove/requests/compute/stop_server.rb
Normal file
13
lib/fog/serverlove/requests/compute/stop_server.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class Serverlove
|
||||||
|
class Real
|
||||||
|
|
||||||
|
def stop_server(server_id)
|
||||||
|
request(:method => "post", :path => "/servers/#{server_id}/stop", :expects => 204)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -13,7 +13,7 @@ Shindo.tests('Fog::Compute[:serverlove] | server requests', ['serverlove']) do
|
||||||
|
|
||||||
tests('success') do
|
tests('success') do
|
||||||
|
|
||||||
attributes = { 'name' => 'Test', 'cpu' => '1000' }
|
attributes = { 'name' => 'Test', 'cpu' => '1000', 'persistent' => 'true' }
|
||||||
|
|
||||||
tests("#create_server").formats(@server_format) do
|
tests("#create_server").formats(@server_format) do
|
||||||
@server = Fog::Compute[:serverlove].create_server(attributes).body
|
@server = Fog::Compute[:serverlove].create_server(attributes).body
|
||||||
|
@ -29,6 +29,21 @@ Shindo.tests('Fog::Compute[:serverlove] | server requests', ['serverlove']) do
|
||||||
Fog::Compute[:serverlove].servers.get(@server['server']).name == "Diff"
|
Fog::Compute[:serverlove].servers.get(@server['server']).name == "Diff"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
tests("#start_server").succeeds do
|
||||||
|
Fog::Compute[:serverlove].start_server(@server['server'])
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("#reset_server").succeeds do
|
||||||
|
Fog::Compute[:serverlove].reset_server(@server['server'])
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("#shutdown_server").succeeds do
|
||||||
|
Fog::Compute[:serverlove].shutdown_server(@server['server'])
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("#stop_server").succeeds do
|
||||||
|
Fog::Compute[:serverlove].stop_server(@server['server'])
|
||||||
|
end
|
||||||
|
|
||||||
tests("#destroy_server").succeeds do
|
tests("#destroy_server").succeeds do
|
||||||
Fog::Compute[:serverlove].destroy_server(@server['server'])
|
Fog::Compute[:serverlove].destroy_server(@server['server'])
|
||||||
|
|
Loading…
Reference in a new issue