tests/aws/requests/compute/image_tests.rb in fog-maestrodev-1.8.0.20130114204828 vs tests/aws/requests/compute/image_tests.rb in fog-maestrodev-1.14.0.20130806165225
- old
+ new
@@ -1,10 +1,10 @@
Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do
@describe_images_format = {
'imagesSet' => [{
'architecture' => String,
- 'blockDeviceMapping' => [],
+ 'blockDeviceMapping' => [Fog::Nullable::Hash],
'description' => Fog::Nullable::String,
'hypervisor' => String,
'imageId' => String,
'imageLocation' => String,
'imageOwnerAlias' => Fog::Nullable::String,
@@ -37,10 +37,15 @@
}
@create_image_format = {
'requestId' => String,
'imageId' => String
}
+
+ @image_copy_result = {
+ 'requestId' => String,
+ 'imageId' => String
+ }
tests('success') do
# the result for this is HUGE and relatively uninteresting...
# tests("#describe_images").formats(@images_format) do
# Fog::Compute[:aws].describe_images.body
@@ -66,10 +71,16 @@
tests("#create_image - automatic ebs image registration").returns(true) do
create_image_response = Fog::Compute[:aws].create_image(@server.id, 'Fog-Test-Image', 'Fog Test Image')
Fog::Compute[:aws].images.get(create_image_response.body['imageId']) != nil
end
@server.destroy
+
+ tests("#copy_image (#{@image_id}, 'eu-west-1')").formats(@image_copy_result) do
+ data = Fog::Compute.new(:provider => :aws, :region => "us-west-1", :version => "2013-02-01").copy_image(@image_id, "eu-east-1").body
+ @eu_image_id = data['imageId']
+ data
+ end
tests("#register_image").formats(@register_image_format) do
@image = Fog::Compute[:aws].register_image('image', 'image', '/dev/sda1').body
end
@@ -120,10 +131,19 @@
unless Fog.mocking?
tests("#describe_images('Owner' => '#{@other_image['imageOwnerAlias']}', 'image-id' => '#{@image_id}')").formats(@describe_images_format) do
Fog::Compute[:aws].describe_images('Owner' => @other_image['imageOwnerAlias'], 'image-id' => @image_id).body
end
end
+
+ #NOTE: waiting for the image to complete can sometimes take up to 1 hour
+ # for quicker tests: uncomment the rest of this block
+ #Fog.wait_for { Fog::Compute.new(:provider => :aws, :region => "us-west-1").snapshots.get(@eu_image_id) }
+
+ #tests("#delete_snapshots(#{@eu_image_id})").formats(AWS::Compute::Formats::BASIC) do
+ # Fog::Compute.new(:provider => :aws, :region => "us-west-1").delete_snapshot(@eu_image_id).body
+ #end
+
end
tests('failure') do
tests("#modify_image_attribute(nil, { 'Add.Group' => ['all'] })").raises(ArgumentError) do
Fog::Compute[:aws].modify_image_attribute(nil, { 'Add.Group' => ['all'] }).body
@@ -133,6 +153,6 @@
pending unless Fog.mocking?
Fog::Compute[:aws].modify_image_attribute('ami-00000000', { 'Add.UserId' => ['123456789012'] }).body
end
end
-end
\ No newline at end of file
+end