mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Test for creating a bootable volume.
This commit is contained in:
parent
b7ada3523c
commit
42702af728
1 changed files with 20 additions and 6 deletions
|
@ -10,6 +10,7 @@ Shindo.tests('Fog::Rackspace::BlockStorage | volume_tests', ['rackspace']) do
|
|||
'volume_type' => String,
|
||||
'availability_zone' => String,
|
||||
'snapshot_id' => Fog::Nullable::String,
|
||||
'image_id' => Fog::Nullable::String,
|
||||
'attachments' => Array,
|
||||
'metadata' => Hash
|
||||
}
|
||||
|
@ -25,12 +26,23 @@ Shindo.tests('Fog::Rackspace::BlockStorage | volume_tests', ['rackspace']) do
|
|||
service = Fog::Rackspace::BlockStorage.new
|
||||
|
||||
tests('success') do
|
||||
id = nil
|
||||
ids = []
|
||||
size = 100
|
||||
|
||||
tests("#create_volume(#{size})").formats(get_volume_format) do
|
||||
data = service.create_volume(size).body
|
||||
id = data['volume']['id']
|
||||
ids << data['volume']['id']
|
||||
data
|
||||
end
|
||||
|
||||
tests("#create_volume for a bootable volume").formats(get_volume_format) do
|
||||
# Find a suitable image.
|
||||
image_id = rackspace_test_image_id(Fog::Compute.new(:provider => 'rackspace'))
|
||||
data = service.create_volume(size, :image_id => image_id).body
|
||||
tests("assigned an image id").returns(image_id) do
|
||||
data['volume']['image_id']
|
||||
end
|
||||
ids << data['volume']['id']
|
||||
data
|
||||
end
|
||||
|
||||
|
@ -38,14 +50,16 @@ Shindo.tests('Fog::Rackspace::BlockStorage | volume_tests', ['rackspace']) do
|
|||
service.list_volumes.body
|
||||
end
|
||||
|
||||
tests("#get_volume(#{id})").formats(get_volume_format) do
|
||||
service.get_volume(id).body
|
||||
tests("#get_volume(#{ids.first})").formats(get_volume_format) do
|
||||
service.get_volume(ids.first).body
|
||||
end
|
||||
|
||||
ids.each do |id|
|
||||
tests("#delete_volume(#{id})").succeeds do
|
||||
service.delete_volume(id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
tests("#create_volume(-1)").raises(Fog::Rackspace::BlockStorage::BadRequest) do
|
||||
|
|
Loading…
Add table
Reference in a new issue