1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/compute/requests/aws/snapshot_tests.rb

58 lines
1.6 KiB
Ruby
Raw Normal View History

2010-09-09 20:50:38 -04:00
Shindo.tests('AWS::Compute | snapshot requests', ['aws']) do
@snapshot_format = {
'description' => Fog::Nullable::String,
'ownerId' => String,
'progress' => String,
'snapshotId' => String,
'startTime' => Time,
'status' => String,
'volumeId' => String,
'volumeSize' => Integer
}
@snapshots_format = {
'requestId' => String,
2010-10-12 19:01:17 -04:00
'snapshotSet' => [@snapshot_format.merge('tagSet' => {})]
}
2010-09-09 20:50:38 -04:00
@volume = AWS[:compute].volumes.create(:availability_zone => 'us-east-1a', :size => 1)
tests('success') do
@snapshot_id = nil
tests("#create_snapshot(#{@volume.identity})").formats(@snapshot_format.merge('progress' => NilClass, 'requestId' => String)) do
2010-09-09 20:50:38 -04:00
data = AWS[:compute].create_snapshot(@volume.identity).body
2010-05-21 17:43:29 -04:00
@snapshot_id = data['snapshotId']
data
end
Fog.wait_for { AWS[:compute].snapshots.get(@snapshot_id) }
2010-09-09 20:50:38 -04:00
AWS[:compute].snapshots.get(@snapshot_id).wait_for { ready? }
2010-05-26 18:24:44 -04:00
tests("#describe_snapshots").formats(@snapshots_format) do
2010-09-09 20:50:38 -04:00
AWS[:compute].describe_snapshots.body
end
tests("#describe_snapshots('snapshot-id' => '#{@snapshot_id}')").formats(@snapshots_format) do
AWS[:compute].describe_snapshots('snapshot-id' => @snapshot_id).body
end
2010-09-09 20:50:38 -04:00
tests("#delete_snapshots(#{@snapshot_id})").formats(AWS::Compute::Formats::BASIC) do
AWS[:compute].delete_snapshot(@snapshot_id).body
end
end
tests ('failure') do
2010-09-09 20:50:38 -04:00
tests("#delete_snapshot('snap-00000000')").raises(Fog::AWS::Compute::NotFound) do
AWS[:compute].delete_snapshot('snap-00000000')
end
end
@volume.destroy
end