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-06-20 07:11:11 -04:00
|
|
|
@server = Fog::Compute[:brightbox].servers.create(compute_providers[:brightbox][:server_attributes])
|
2011-01-03 20:16:00 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
tests("#create_cloud_ip").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
data = Fog::Compute[:brightbox].create_cloud_ip
|
2010-12-06 09:50:59 -05:00
|
|
|
@cloud_ip_id = data["id"]
|
|
|
|
data
|
|
|
|
end
|
|
|
|
|
2011-01-03 20:16:00 -05:00
|
|
|
tests("#list_cloud_ips").formats(Brightbox::Compute::Formats::Collection::CLOUD_IPS) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:brightbox].list_cloud_ips
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
tests("#get_cloud_ip('#{@cloud_ip_id}')").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) 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(@cloud_ip_id)
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
2010-12-17 19:49:22 -05:00
|
|
|
unless Fog.mocking?
|
2011-01-03 20:16:00 -05:00
|
|
|
@server.wait_for { ready? }
|
|
|
|
map_options = {:interface => @server.interfaces.first["id"]}
|
2010-12-17 19:49:22 -05:00
|
|
|
end
|
|
|
|
|
2010-12-06 09:50:59 -05:00
|
|
|
tests("#map_cloud_ip('#{@cloud_ip_id}', #{map_options.inspect})").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:brightbox].map_cloud_ip(@cloud_ip_id, map_options)
|
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
|
|
|
|
|
|
|
tests("#unmap_cloud_ip('#{@cloud_ip_id}')").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:brightbox].unmap_cloud_ip(@cloud_ip_id)
|
2010-12-06 09:50:59 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
tests("#destroy_cloud_ip('#{@cloud_ip_id}')").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do
|
2010-12-17 19:49:22 -05:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:brightbox].destroy_cloud_ip(@cloud_ip_id)
|
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
|