2011-06-16 19:28:54 -04:00
|
|
|
Shindo.tests('Fog::Compute[:bluebox] | block requests', ['bluebox']) do
|
2010-06-04 00:32:59 -04:00
|
|
|
|
|
|
|
@block_format = {
|
2011-05-11 17:40:55 -04:00
|
|
|
'cpu' => Float,
|
|
|
|
'description' => String,
|
|
|
|
'hostname' => String,
|
|
|
|
'id' => String,
|
|
|
|
'ips' => [{'address' => String}],
|
|
|
|
'lb_applications' => [],
|
|
|
|
'memory' => Integer,
|
2012-02-16 21:43:25 -05:00
|
|
|
'product' => {'cost' => String, 'description' => String, 'id' => String},
|
2011-05-11 17:40:55 -04:00
|
|
|
'status' => String,
|
|
|
|
'storage' => Integer,
|
2012-02-16 21:43:25 -05:00
|
|
|
'location_id' => String
|
2010-06-04 00:32:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
tests('success') do
|
|
|
|
|
2012-02-16 21:43:25 -05:00
|
|
|
@flavor_id = compute_providers[:bluebox][:server_attributes][:flavor_id]
|
|
|
|
@image_id = compute_providers[:bluebox][:server_attributes][:image_id]
|
|
|
|
@location_id = compute_providers[:bluebox][:server_attributes][:location_id]
|
|
|
|
@password = compute_providers[:bluebox][:server_attributes][:password]
|
2010-06-04 00:32:59 -04:00
|
|
|
|
|
|
|
@block_id = nil
|
|
|
|
|
2012-02-16 21:43:25 -05:00
|
|
|
tests("create_block('#{@flavor_id}', '#{@image_id}', '#{@location_id}', {'password' => '#{@password}'})").formats(@block_format.merge('add_to_lb_application_results' => {'text' => String})) do
|
2010-10-13 20:54:14 -04:00
|
|
|
pending if Fog.mocking?
|
2012-02-16 21:43:25 -05:00
|
|
|
data = Fog::Compute[:bluebox].create_block(@flavor_id, @image_id, @location_id, {'password' => @password}).body
|
2010-06-04 00:32:59 -04:00
|
|
|
@block_id = data['id']
|
|
|
|
data
|
|
|
|
end
|
|
|
|
|
2010-10-13 20:54:14 -04:00
|
|
|
unless Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:bluebox].servers.get(@block_id).wait_for { ready? }
|
2010-10-13 20:54:14 -04:00
|
|
|
end
|
2010-06-04 00:32:59 -04:00
|
|
|
|
|
|
|
tests("get_block('#{@block_id}')").formats(@block_format) do
|
2010-10-13 20:54:14 -04:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:bluebox].get_block(@block_id).body
|
2010-06-04 00:32:59 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
tests("get_blocks").formats([@block_format.reject {|key,value| ['product', 'template'].include?(key)}]) do
|
2010-10-13 20:54:14 -04:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:bluebox].get_blocks.body
|
2010-06-04 00:32:59 -04:00
|
|
|
end
|
|
|
|
|
2012-02-16 21:43:25 -05:00
|
|
|
tests("reboot_block('#{@block_id}')").formats([{'status' => String}, {'text' => String}]) do
|
2010-10-13 20:54:14 -04:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:bluebox].reboot_block(@block_id).body
|
2010-06-04 00:32:59 -04:00
|
|
|
end
|
|
|
|
|
2010-10-13 20:54:14 -04:00
|
|
|
unless Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:bluebox].servers.get(@block_id).wait_for { ready? }
|
2010-10-13 20:54:14 -04:00
|
|
|
end
|
2010-06-04 00:32:59 -04:00
|
|
|
|
|
|
|
tests("destroy_block('#{@block_id})'").formats({'text' => String}) do
|
2010-10-13 20:54:14 -04:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:bluebox].destroy_block(@block_id).body
|
2010-06-04 00:32:59 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('failure') do
|
|
|
|
|
2011-06-16 19:28:54 -04:00
|
|
|
tests("get_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do
|
2010-10-13 20:54:14 -04:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:bluebox].get_block('00000000-0000-0000-0000-000000000000')
|
2010-06-04 00:32:59 -04:00
|
|
|
end
|
|
|
|
|
2011-06-16 19:28:54 -04:00
|
|
|
tests("reboot_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do
|
2010-10-13 20:54:14 -04:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:bluebox].reboot_block('00000000-0000-0000-0000-000000000000')
|
2010-06-04 00:32:59 -04:00
|
|
|
end
|
|
|
|
|
2011-06-16 19:28:54 -04:00
|
|
|
tests("destroy_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do
|
2010-10-13 20:54:14 -04:00
|
|
|
pending if Fog.mocking?
|
2011-06-16 19:28:54 -04:00
|
|
|
Fog::Compute[:bluebox].destroy_block('00000000-0000-0000-0000-000000000000')
|
2010-06-04 00:32:59 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|