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,
|
'volume_type' => String,
|
||||||
'availability_zone' => String,
|
'availability_zone' => String,
|
||||||
'snapshot_id' => Fog::Nullable::String,
|
'snapshot_id' => Fog::Nullable::String,
|
||||||
|
'image_id' => Fog::Nullable::String,
|
||||||
'attachments' => Array,
|
'attachments' => Array,
|
||||||
'metadata' => Hash
|
'metadata' => Hash
|
||||||
}
|
}
|
||||||
|
@ -25,12 +26,23 @@ Shindo.tests('Fog::Rackspace::BlockStorage | volume_tests', ['rackspace']) do
|
||||||
service = Fog::Rackspace::BlockStorage.new
|
service = Fog::Rackspace::BlockStorage.new
|
||||||
|
|
||||||
tests('success') do
|
tests('success') do
|
||||||
id = nil
|
ids = []
|
||||||
size = 100
|
size = 100
|
||||||
|
|
||||||
tests("#create_volume(#{size})").formats(get_volume_format) do
|
tests("#create_volume(#{size})").formats(get_volume_format) do
|
||||||
data = service.create_volume(size).body
|
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
|
data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -38,14 +50,16 @@ Shindo.tests('Fog::Rackspace::BlockStorage | volume_tests', ['rackspace']) do
|
||||||
service.list_volumes.body
|
service.list_volumes.body
|
||||||
end
|
end
|
||||||
|
|
||||||
tests("#get_volume(#{id})").formats(get_volume_format) do
|
tests("#get_volume(#{ids.first})").formats(get_volume_format) do
|
||||||
service.get_volume(id).body
|
service.get_volume(ids.first).body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
ids.each do |id|
|
||||||
tests("#delete_volume(#{id})").succeeds do
|
tests("#delete_volume(#{id})").succeeds do
|
||||||
service.delete_volume(id)
|
service.delete_volume(id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
tests('failure') do
|
tests('failure') do
|
||||||
tests("#create_volume(-1)").raises(Fog::Rackspace::BlockStorage::BadRequest) do
|
tests("#create_volume(-1)").raises(Fog::Rackspace::BlockStorage::BadRequest) do
|
||||||
|
|
Loading…
Add table
Reference in a new issue