2010-12-06 09:50:59 -05:00
|
|
|
Shindo.tests('Brightbox::Compute | server requests', ['brightbox']) do
|
|
|
|
|
|
|
|
tests('success') do
|
|
|
|
|
|
|
|
image_id = Brightbox::Compute::TestSupport::IMAGE_IDENTIFER
|
|
|
|
server_id = nil
|
|
|
|
|
|
|
|
tests("#create_server(:image => '#{image_id}')").formats(Brightbox::Compute::Formats::Full::SERVER) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2010-12-06 09:50:59 -05:00
|
|
|
data = Brightbox[:compute].create_server(:image => image_id)
|
|
|
|
server_id = data["id"]
|
|
|
|
data
|
|
|
|
end
|
|
|
|
|
2010-12-17 19:49:22 -05:00
|
|
|
unless Fog.mocking?
|
|
|
|
Brightbox[:compute].servers.get(server_id).wait_for { ready? }
|
|
|
|
end
|
2010-12-06 09:50:59 -05:00
|
|
|
|
2010-12-17 19:49:22 -05:00
|
|
|
tests("#list_servers").formats(Brightbox::Compute::Formats::Collection::SERVERS) do
|
|
|
|
pending if Fog.mocking?
|
|
|
|
Brightbox[:compute].list_servers
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
tests("#get_server('#{server_id}')").formats(Brightbox::Compute::Formats::Full::SERVER) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2010-12-06 09:50:59 -05:00
|
|
|
Brightbox[:compute].get_server(server_id)
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#update_server('#{server_id}')").formats(Brightbox::Compute::Formats::Full::SERVER) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2010-12-06 09:50:59 -05:00
|
|
|
Brightbox[:compute].update_server(server_id, :name => "New name from Fog test")
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#stop_server('#{server_id}')").formats(Brightbox::Compute::Formats::Full::SERVER) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2010-12-06 09:50:59 -05:00
|
|
|
Brightbox[:compute].stop_server(server_id)
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#start_server('#{server_id}')").formats(Brightbox::Compute::Formats::Full::SERVER) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2010-12-06 09:50:59 -05:00
|
|
|
Brightbox[:compute].start_server(server_id)
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#shutdown_server('#{server_id}')").formats(Brightbox::Compute::Formats::Full::SERVER) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2010-12-06 09:50:59 -05:00
|
|
|
Brightbox[:compute].shutdown_server(server_id)
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("#destroy_server('#{server_id}')").formats(Brightbox::Compute::Formats::Full::SERVER) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2010-12-06 09:50:59 -05:00
|
|
|
Brightbox[:compute].destroy_server(server_id)
|
|
|
|
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?
|
2010-12-06 09:50:59 -05:00
|
|
|
Brightbox[:compute].get_server('srv-00000')
|
|
|
|
end
|
|
|
|
|
2010-12-17 19:49:22 -05:00
|
|
|
tests("#get_server").raises(ArgumentError) do
|
|
|
|
pending if Fog.mocking?
|
|
|
|
Brightbox[:compute].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
|