2010-09-09 20:50:38 -04:00
|
|
|
Shindo.tests('AWS::Compute | snapshot requests', ['aws']) do
|
2010-05-08 18:16:35 -04:00
|
|
|
|
2010-05-26 18:22:23 -04:00
|
|
|
@snapshot_format = {
|
2011-04-27 16:19:19 -04:00
|
|
|
'description' => Fog::Nullable::String,
|
2010-05-26 18:22:23 -04:00
|
|
|
'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-05-26 18:22:23 -04:00
|
|
|
}
|
|
|
|
|
2010-09-09 20:50:38 -04:00
|
|
|
@volume = AWS[:compute].volumes.create(:availability_zone => 'us-east-1a', :size => 1)
|
2010-05-08 18:16:35 -04:00
|
|
|
|
|
|
|
tests('success') do
|
|
|
|
|
|
|
|
@snapshot_id = nil
|
|
|
|
|
2010-05-26 18:22:23 -04:00
|
|
|
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
|
2010-05-08 18:16:35 -04:00
|
|
|
end
|
|
|
|
|
2010-10-04 18:46:12 -04:00
|
|
|
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
|
|
|
|
2010-05-26 18:22:23 -04:00
|
|
|
tests("#describe_snapshots").formats(@snapshots_format) do
|
2010-09-09 20:50:38 -04:00
|
|
|
AWS[:compute].describe_snapshots.body
|
2010-05-08 18:16:35 -04:00
|
|
|
end
|
|
|
|
|
2010-10-04 18:46:12 -04:00
|
|
|
tests("#describe_snapshots('snapshot-id' => '#{@snapshot_id}')").formats(@snapshots_format) do
|
|
|
|
AWS[:compute].describe_snapshots('snapshot-id' => @snapshot_id).body
|
2010-05-08 18:16:35 -04:00
|
|
|
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
|
2010-05-08 18:16:35 -04:00
|
|
|
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')
|
2010-05-08 18:16:35 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
@volume.destroy
|
|
|
|
|
|
|
|
end
|