From e27c195dd6f283b09057daee5ccca6c420f0aa5f Mon Sep 17 00:00:00 2001 From: Eric Stonfer Date: Sun, 1 Apr 2012 22:29:36 -0400 Subject: [PATCH] minor fix to ENI tests --- .../aws/requests/compute/detach_network_interface.rb | 2 +- .../aws/requests/compute/network_interface_tests.rb | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/fog/aws/requests/compute/detach_network_interface.rb b/lib/fog/aws/requests/compute/detach_network_interface.rb index 6bfc24f52..8fa95010d 100644 --- a/lib/fog/aws/requests/compute/detach_network_interface.rb +++ b/lib/fog/aws/requests/compute/detach_network_interface.rb @@ -28,7 +28,7 @@ module Fog end class Mock - def detach_network_interface(attachment_id) + def detach_network_interface(attachment_id, force = false) response = Excon::Response.new nic_id = self.data[:network_interfaces].select { |k,v| v['attachment']['attachmentId'] == attachment_id} .first.first if nic_id diff --git a/tests/aws/requests/compute/network_interface_tests.rb b/tests/aws/requests/compute/network_interface_tests.rb index dc620c87a..cf8b3202a 100644 --- a/tests/aws/requests/compute/network_interface_tests.rb +++ b/tests/aws/requests/compute/network_interface_tests.rb @@ -130,7 +130,9 @@ Shindo.tests('Fog::Compute[:aws] | network interface requests', ['aws']) do tests('#detach_network_interface').returns(true) do Fog::Compute[:aws].detach_network_interface(@attachment_id,true).body["return"] end - Fog::Compute[:aws].network_interfaces.get(@nic_id).wait_for { status == 'available'} + if !Fog.mocking? + Fog::Compute[:aws].network_interfaces.get(@nic_id).wait_for { status == 'available'} + end # Create network interface with arguments options = { "PrivateIpAddress" => "10.0.10.24", @@ -161,9 +163,11 @@ Shindo.tests('Fog::Compute[:aws] | network interface requests', ['aws']) do # Clean up resources @server.destroy - @server.wait_for { state == 'terminated' } - # despite the fact that the state goes to 'terminated' we need a little delay for aws to do its thing - sleep 5 + if !Fog.mocking? + @server.wait_for { state == 'terminated' } + # despite the fact that the state goes to 'terminated' we need a little delay for aws to do its thing + sleep 5 + end @security_group.destroy @subnet.destroy @vpc.destroy