mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Add shindo tests for snapshots request layer methods.
This commit is contained in:
parent
fce2677198
commit
42af8f6e04
2 changed files with 57 additions and 1 deletions
56
tests/hp/requests/block_storage/snapshot_tests.rb
Normal file
56
tests/hp/requests/block_storage/snapshot_tests.rb
Normal file
|
@ -0,0 +1,56 @@
|
|||
Shindo.tests('Fog::BlockStorage[:hp] | snapshot requests', ['hp', 'block_storage', 'snapshots']) do
|
||||
|
||||
@snapshot_format = {
|
||||
'status' => String,
|
||||
'displayDescription' => Fog::Nullable::String,
|
||||
'displayName' => Fog::Nullable::String,
|
||||
'volumeId' => Integer,
|
||||
'size' => Integer,
|
||||
'id' => Integer,
|
||||
'createdAt' => String
|
||||
}
|
||||
|
||||
tests('success') do
|
||||
|
||||
@snapshot_id = nil
|
||||
@snapshot_name = "fogsnapshottests"
|
||||
@snapshot_desc = @snapshot_name + " desc"
|
||||
|
||||
@volume = Fog::BlockStorage[:hp].volumes.create(:name => 'fogvolforsnap', :size => 1)
|
||||
@volume.wait_for { ready? }
|
||||
|
||||
tests("#create_snapshot(#{@snapshot_name}, #{@snapshot_desc}, #{@volume.id})").formats(@snapshot_format) do
|
||||
data = Fog::BlockStorage[:hp].create_snapshot(@snapshot_name, @snapshot_desc, @volume.id).body['snapshot']
|
||||
@snapshot_id = data['id']
|
||||
data
|
||||
end
|
||||
|
||||
tests("#get_snapshot_details(#{@snapshot_id})").formats(@snapshot_format) do
|
||||
Fog::BlockStorage[:hp].get_snapshot_details(@snapshot_id).body['snapshot']
|
||||
end
|
||||
|
||||
tests('#list_snapshots').formats({'snapshots' => [@snapshot_format]}) do
|
||||
Fog::BlockStorage[:hp].list_snapshots.body
|
||||
end
|
||||
|
||||
tests("#delete_snapshot(#{@snapshot_id})").succeeds do
|
||||
Fog::BlockStorage[:hp].delete_snapshot(@snapshot_id)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests('#get_snapshot_details(0)').raises(Fog::BlockStorage::HP::NotFound) do
|
||||
Fog::BlockStorage[:hp].get_snapshot_details(0)
|
||||
end
|
||||
|
||||
tests("#delete_snapshot(0)").raises(Fog::BlockStorage::HP::NotFound) do
|
||||
Fog::BlockStorage[:hp].delete_snapshot(0)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@volume.destroy
|
||||
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
Shindo.tests('Fog::BlockStorage[:hp] | volume requests', ['hp', 'block_storage']) do
|
||||
Shindo.tests('Fog::BlockStorage[:hp] | volume requests', ['hp', 'block_storage', 'volumes']) do
|
||||
|
||||
@volume_format = {
|
||||
'status' => String,
|
||||
|
|
Loading…
Add table
Reference in a new issue