From b87c104211b95580406bc4ff05ca0432ae6e847d Mon Sep 17 00:00:00 2001 From: Dylan Egan Date: Fri, 8 Jul 2011 15:39:35 -0700 Subject: [PATCH] AWS instance tests 100% against real. --- lib/fog/compute/requests/aws/describe_instances.rb | 2 +- lib/fog/compute/requests/aws/run_instances.rb | 4 +--- tests/compute/requests/aws/instance_tests.rb | 12 ++++++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/fog/compute/requests/aws/describe_instances.rb b/lib/fog/compute/requests/aws/describe_instances.rb index 48adfe8db..85289d8b0 100644 --- a/lib/fog/compute/requests/aws/describe_instances.rb +++ b/lib/fog/compute/requests/aws/describe_instances.rb @@ -187,7 +187,7 @@ module Fog 'ownerId' => instance['ownerId'], 'reservationId' => instance['reservationId'] } - reservation_set[instance['reservationId']]['instancesSet'] << instance.reject{|key,value| !['amiLaunchIndex', 'architecture', 'blockDeviceMapping', 'clientToken', 'dnsName', 'imageId', 'instanceId', 'instanceState', 'instanceType', 'ipAddress', 'kernelId', 'keyName', 'launchTime', 'monitoring', 'placement', 'privateDnsName', 'privateIpAddress', 'productCodes', 'ramdiskId', 'reason', 'rootDeviceType', 'stateReason', 'tagSet'].include?(key)} + reservation_set[instance['reservationId']]['instancesSet'] << instance.reject{|key,value| !['amiLaunchIndex', 'architecture', 'blockDeviceMapping', 'clientToken', 'dnsName', 'imageId', 'instanceId', 'instanceState', 'instanceType', 'kernelId', 'keyName', 'launchTime', 'monitoring', 'placement', 'privateDnsName', 'productCodes', 'ramdiskId', 'reason', 'rootDeviceType', 'stateReason', 'tagSet'].include?(key)} end end diff --git a/lib/fog/compute/requests/aws/run_instances.rb b/lib/fog/compute/requests/aws/run_instances.rb index 1f5b0696a..104dec495 100644 --- a/lib/fog/compute/requests/aws/run_instances.rb +++ b/lib/fog/compute/requests/aws/run_instances.rb @@ -135,14 +135,12 @@ module Fog 'instanceId' => instance_id, 'instanceState' => { 'code' => 0, 'name' => 'pending' }, 'instanceType' => options['InstanceType'] || 'm1.small', - 'kernelId' => options['KernelId'] || Fog::AWS::Mock.kernel_id, 'keyName' => options['KeyName'], 'launchTime' => Time.now, 'monitoring' => { 'state' => options['Monitoring.Enabled'] || false }, - 'placement' => { 'availabilityZone' => options['Placement.AvailabilityZone'] || Fog::AWS::Mock.availability_zone(@region) }, + 'placement' => { 'availabilityZone' => options['Placement.AvailabilityZone'] || Fog::AWS::Mock.availability_zone(@region), 'groupName' => nil, 'tenancy' => 'default' }, 'privateDnsName' => nil, 'productCodes' => [], - 'ramdiskId' => options['RamdiskId'] || Fog::AWS::Mock.ramdisk_id, 'reason' => nil, 'rootDeviceType' => 'instance-store' } diff --git a/tests/compute/requests/aws/instance_tests.rb b/tests/compute/requests/aws/instance_tests.rb index 204c085c6..7a9b06142 100644 --- a/tests/compute/requests/aws/instance_tests.rb +++ b/tests/compute/requests/aws/instance_tests.rb @@ -11,15 +11,19 @@ Shindo.tests('Fog::Compute[:aws] | instance requests', ['aws']) do 'instanceState' => {'code' => Integer, 'name' => String}, 'instanceType' => String, # 'ipAddress' => String, - 'kernelId' => Fog::Nullable::String, + # 'kernelId' => Fog::Nullable::String, 'keyName' => Fog::Nullable::String, 'launchTime' => Time, 'monitoring' => {'state' => Fog::Boolean}, - 'placement' => {'availabilityZone' => String}, + 'placement' => { + 'availabilityZone' => String, + 'groupName' => Fog::Nullable::String, + 'tenancy' => String + }, 'privateDnsName' => NilClass, # 'privateIpAddress' => String, 'productCodes' => [], - 'ramdiskId' => Fog::Nullable::String, + # 'ramdiskId' => Fog::Nullable::String, 'reason' => Fog::Nullable::String, # 'rootDeviceName' => String, 'rootDeviceType' => String, @@ -100,7 +104,7 @@ Shindo.tests('Fog::Compute[:aws] | instance requests', ['aws']) do server.wait_for { ready? } tests("#describe_instances").formats(@describe_instances_format) do - Fog::Compute[:aws].describe_instances.body + Fog::Compute[:aws].describe_instances('instance-state-name' => 'running').body end # Launch another instance to test filters