2011-06-16 19:28:54 -04:00
|
|
|
Shindo.tests('Fog::Compute[:brightbox] | cloud ip requests', ['brightbox']) do
|
2010-12-06 09:50:59 -05:00
|
|
|
|
|
|
|
tests('success') do
|
|
|
|
|
2011-01-03 20:16:00 -05:00
|
|
|
unless Fog.mocking?
|
2011-09-30 06:42:12 -04:00
|
|
|
@server = Brightbox::Compute::TestSupport.get_test_server
|
2011-01-03 20:16:00 -05:00
|
|
|
end
|
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#create_cloud_ip") 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_cloud_ip
|
|
|
|
@cloud_ip_id = result["id"]
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Full::CLOUD_IP, false) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#list_cloud_ips") 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_cloud_ips
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Collection::CLOUD_IPS, false) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#get_cloud_ip('#{@cloud_ip_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_cloud_ip(@cloud_ip_id)
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Full::CLOUD_IP, false) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2011-12-12 15:20:52 -05:00
|
|
|
unless Fog.mocking?
|
|
|
|
map_options = {:destination => @server.interfaces.first["id"]}
|
|
|
|
end
|
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#map_cloud_ip('#{@cloud_ip_id}', #{map_options.inspect})") 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].map_cloud_ip(@cloud_ip_id, map_options)
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Full::CLOUD_IP, 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].cloud_ips.get(@cloud_ip_id).wait_for { mapped? }
|
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("#unmap_cloud_ip('#{@cloud_ip_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].unmap_cloud_ip(@cloud_ip_id)
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Full::CLOUD_IP, false) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2011-12-12 15:20:52 -05:00
|
|
|
unless Fog.mocking?
|
|
|
|
update_options = {:reverse_dns => "public.#{@server.id}.gb1.brightbox.com"}
|
|
|
|
end
|
|
|
|
|
2011-09-29 08:09:11 -04:00
|
|
|
tests("#update_cloud_ip('#{@cloud_ip_id}', #{update_options.inspect})") do
|
|
|
|
pending if Fog.mocking?
|
|
|
|
result = Fog::Compute[:brightbox].update_cloud_ip(@cloud_ip_id, update_options)
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Full::CLOUD_IP, false) { result }
|
2011-09-29 08:09:11 -04:00
|
|
|
result = Fog::Compute[:brightbox].update_cloud_ip(@cloud_ip_id, {:reverse_dns => ""})
|
|
|
|
end
|
|
|
|
|
2011-09-29 05:15:03 -04:00
|
|
|
tests("#destroy_cloud_ip('#{@cloud_ip_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_cloud_ip(@cloud_ip_id)
|
2012-02-06 05:49:18 -05:00
|
|
|
formats(Brightbox::Compute::Formats::Full::CLOUD_IP, false) { result }
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2011-01-03 20:16:00 -05:00
|
|
|
unless Fog.mocking?
|
|
|
|
@server.destroy
|
|
|
|
end
|
|
|
|
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
tests('failure') do
|
|
|
|
|
|
|
|
tests("#get_cloud_ip('cip-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_cloud_ip('cip-00000')
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2010-12-17 19:49:22 -05:00
|
|
|
tests("#get_cloud_ip").raises(ArgumentError) do
|
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:brightbox].get_cloud_ip
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
2010-12-17 19:49:22 -05:00
|
|
|
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2011-01-03 20:16:00 -05:00
|
|
|
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|