2013-01-14 17:52:16 -05:00
|
|
|
Shindo.tests("HP::BlockStorage | bootable volume requests", ['hp', 'block_storage', 'volumes']) do
|
2012-12-04 02:18:10 -05:00
|
|
|
|
|
|
|
@volume_format = {
|
|
|
|
'status' => String,
|
|
|
|
'displayDescription' => Fog::Nullable::String,
|
|
|
|
'availabilityZone' => String,
|
|
|
|
'displayName' => Fog::Nullable::String,
|
|
|
|
'attachments' => [Fog::Nullable::Hash],
|
|
|
|
'volumeType' => Fog::Nullable::String,
|
|
|
|
'snapshotId' => Fog::Nullable::String,
|
|
|
|
'size' => Integer,
|
|
|
|
'id' => Integer,
|
|
|
|
'createdAt' => String,
|
|
|
|
'metadata' => Fog::Nullable::Hash
|
|
|
|
}
|
|
|
|
|
|
|
|
@boot_volume_format = {
|
|
|
|
'status' => String,
|
|
|
|
'displayDescription' => Fog::Nullable::String,
|
|
|
|
'availabilityZone' => String,
|
|
|
|
'displayName' => Fog::Nullable::String,
|
|
|
|
'attachments' => [Fog::Nullable::Hash],
|
|
|
|
'volumeType' => Fog::Nullable::String,
|
|
|
|
'snapshotId' => Fog::Nullable::String,
|
|
|
|
'source_image_id' => Fog::Nullable::String,
|
|
|
|
'size' => Integer,
|
|
|
|
'id' => Integer,
|
|
|
|
'createdAt' => String,
|
|
|
|
'metadata' => Fog::Nullable::Hash
|
|
|
|
}
|
|
|
|
|
|
|
|
@volume_attach_format = {
|
|
|
|
"volumeId" => Integer,
|
|
|
|
"id" => Integer
|
|
|
|
}
|
|
|
|
|
|
|
|
tests('success') do
|
|
|
|
|
|
|
|
@volume_id = nil
|
|
|
|
@volume_name = "fogbvolumetests"
|
|
|
|
@volume_desc = @volume_name + " desc"
|
|
|
|
@base_image_id = ENV["BASE_IMAGE_ID"] || 1242
|
|
|
|
|
|
|
|
tests("#create_volume(#{@volume_name}, #{@volume_desc}, 10, {'imageRef' => '#{@base_image_id}'})").formats(@volume_format) do
|
2013-01-14 17:52:16 -05:00
|
|
|
data = HP[:block_storage].create_volume(@volume_name, @volume_desc, 10, {'imageRef' => "#{@base_image_id}"}).body['volume']
|
2012-12-04 02:18:10 -05:00
|
|
|
@volume_id = data['id']
|
|
|
|
data
|
|
|
|
end
|
|
|
|
|
2013-01-14 17:52:16 -05:00
|
|
|
HP[:block_storage].volumes.get(@volume_id).wait_for { ready? }
|
2012-12-04 02:18:10 -05:00
|
|
|
tests("#get_bootable_volume_details(#{@volume_id})").formats(@boot_volume_format) do
|
2013-01-14 17:52:16 -05:00
|
|
|
HP[:block_storage].get_bootable_volume_details(@volume_id).body['volume']
|
2012-12-04 02:18:10 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
tests("#list_bootable_volumes").formats({'volumes' => [@boot_volume_format]}) do
|
2013-01-14 17:52:16 -05:00
|
|
|
HP[:block_storage].list_bootable_volumes.body
|
2012-12-04 02:18:10 -05:00
|
|
|
end
|
|
|
|
|
2013-01-14 17:52:16 -05:00
|
|
|
HP[:block_storage].volumes.get(@volume_id).wait_for { ready? }
|
2012-12-04 02:18:10 -05:00
|
|
|
tests("#delete_volume(#{@volume_id})").succeeds do
|
2013-01-14 17:52:16 -05:00
|
|
|
HP[:block_storage].delete_volume(@volume_id)
|
2012-12-04 02:18:10 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('failure') do
|
|
|
|
|
2013-01-14 17:52:16 -05:00
|
|
|
tests("#get_bootable_volume_details(0)").raises(Fog::HP::BlockStorage::NotFound) do
|
|
|
|
HP[:block_storage].get_bootable_volume_details(0)
|
2012-12-04 02:18:10 -05:00
|
|
|
end
|
|
|
|
|
2013-01-14 17:52:16 -05:00
|
|
|
tests("#delete_volume(0)").raises(Fog::HP::BlockStorage::NotFound) do
|
|
|
|
HP[:block_storage].delete_volume(0)
|
2012-12-04 02:18:10 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|