2011-06-16 19:28:54 -04:00
|
|
|
Shindo.tests('Fog::Compute[:brightbox] | server requests', ['brightbox']) do
|
2010-12-06 09:50:59 -05:00
|
|
|
|
|
|
|
tests('success') do
|
|
|
|
|
2011-12-12 15:20:52 -05:00
|
|
|
unless Fog.mocking?
|
|
|
|
image_id = Brightbox::Compute::TestSupport.image_id
|
|
|
|
server_id = nil
|
|
|
|
end
|
2010-12-06 09:50:59 -05:00
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#create_server(:image => '#{image_id}')") do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-09-29 05:15:03 -04:00
|
|
|
result = Fog::Compute[:brightbox].create_server(:image => image_id)
|
|
|
|
server_id = result["id"]
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2010-12-17 19:49:22 -05:00
|
|
|
unless Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:brightbox].servers.get(server_id).wait_for { ready? }
|
2010-12-17 19:49:22 -05:00
|
|
|
end
|
2010-12-06 09:50:59 -05:00
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#list_servers") do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-09-29 05:15:03 -04:00
|
|
|
result = Fog::Compute[:brightbox].list_servers
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Collection::SERVERS, false) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#get_server('#{server_id}')") do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-09-29 05:15:03 -04:00
|
|
|
result = Fog::Compute[:brightbox].get_server(server_id)
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#update_server('#{server_id}')") do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-09-29 05:15:03 -04:00
|
|
|
result = Fog::Compute[:brightbox].update_server(server_id, :name => "Fog@#{Time.now.iso8601}")
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#activate_console_server('#{server_id}')") do
|
2011-03-02 12:41:41 -05:00
|
|
|
pending if Fog.mocking?
|
2011-09-29 05:15:03 -04:00
|
|
|
result = Fog::Compute[:brightbox].activate_console_server(server_id)
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
|
2011-03-02 12:41:41 -05:00
|
|
|
end
|
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#stop_server('#{server_id}')") do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-09-29 05:15:03 -04:00
|
|
|
result = Fog::Compute[:brightbox].stop_server(server_id)
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#start_server('#{server_id}')") do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-09-29 05:15:03 -04:00
|
|
|
result = Fog::Compute[:brightbox].start_server(server_id)
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#shutdown_server('#{server_id}')") do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-09-29 05:15:03 -04:00
|
|
|
result = Fog::Compute[:brightbox].shutdown_server(server_id)
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2011-10-03 08:18:56 -04:00
|
|
|
tests("#snapshot_server('#{server_id}')") do
|
|
|
|
pending if Fog.mocking?
|
|
|
|
result = Fog::Compute[:brightbox].snapshot_server(server_id)
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
|
2012-02-07 12:14:29 -05:00
|
|
|
# Server should be exclusively for our test so assume we can delete the snapshot
|
|
|
|
snapshot_id = result["snapshots"].first["id"]
|
2011-10-03 08:18:56 -04:00
|
|
|
@snapshot = Fog::Compute[:brightbox].images.get(snapshot_id)
|
2012-02-07 12:14:29 -05:00
|
|
|
@snapshot.wait_for { ready? }
|
2011-10-03 08:18:56 -04:00
|
|
|
@snapshot.destroy
|
|
|
|
end
|
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#destroy_server('#{server_id}')") do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-09-29 05:15:03 -04:00
|
|
|
result = Fog::Compute[:brightbox].destroy_server(server_id)
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('failure') do
|
|
|
|
|
|
|
|
tests("#get_server('srv-00000')").raises(Excon::Errors::NotFound) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:brightbox].get_server('srv-00000')
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2010-12-17 19:49:22 -05:00
|
|
|
tests("#get_server").raises(ArgumentError) do
|
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:brightbox].get_server
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
2010-12-30 16:04:19 -05:00
|
|
|
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|