1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/openstack/requests/compute/address_tests.rb
Dan Prince a1f13bb04f OpenStack server test updates for real mode.
Updates to the OpenStack server tests to get things running in *real*
test mode.

This patch also adds some useful helper functions which
are now used to:
 -get the flavor ref for testing
 -get the image ref for testing
 -get the resize flavor ref for testing (defaults to flavor + 1)
 -disable password testing (not all hypervisors support this in OS)
2012-12-07 16:45:01 -05:00

50 lines
1.4 KiB
Ruby

Shindo.tests('Fog::Compute[:openstack] | address requests', ['openstack']) do
compute = Fog::Compute[:openstack]
@server_id = compute.create_server("shindo_test_server", get_image_ref, get_flavor_ref).body['server']['id']
@address_format = {
"instance_id" => NilClass,
"ip" => String,
"fixed_ip" => NilClass,
"id" => Integer,
"pool" => String
}
tests('success') do
tests('#allocate_address').formats({"floating_ip" => @address_format}) do
data = compute.allocate_address.body
@address_id = data['floating_ip']['id']
@address_ip = data['floating_ip']['ip']
data
end
tests('#list_all_addresses').formats({"floating_ips" => [@address_format]}) do
compute.list_all_addresses.body
end
tests('#get_address(address_id)').formats({"floating_ip" => @address_format}) do
compute.get_address(@address_id).body
end
compute.servers.get(@server_id).wait_for { ready? }
tests('#associate_address(server_id, ip_address)').succeeds do
compute.associate_address(@server_id, @address_ip).body
end
tests('#disassociate_address(server_id, ip_address)').succeeds do
compute.disassociate_address(@server_id, @address_ip).body
end
tests('#release_address(ip_address)').succeeds do
compute.release_address(@address_id)
end
end
compute.delete_server(@server_id)
end