From 7d7dd89c93c11adc2cac7f55a6ae761776a19641 Mon Sep 17 00:00:00 2001 From: Caleb Miles Date: Wed, 23 Mar 2016 11:20:53 -0700 Subject: [PATCH] Don't blow up lifecycle tests if an instance we're trying to delete is gone --- src/bosh_aws_cpi/spec/integration/lifecycle_spec.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/bosh_aws_cpi/spec/integration/lifecycle_spec.rb b/src/bosh_aws_cpi/spec/integration/lifecycle_spec.rb index 923197c7..515d9b0d 100644 --- a/src/bosh_aws_cpi/spec/integration/lifecycle_spec.rb +++ b/src/bosh_aws_cpi/spec/integration/lifecycle_spec.rb @@ -52,10 +52,14 @@ end before do - AWS::EC2.new( - access_key_id: @access_key_id, - secret_access_key: @secret_access_key, - ).instances.tagged('delete_me').each(&:terminate) + begin + AWS::EC2.new( + access_key_id: @access_key_id, + secret_access_key: @secret_access_key, + ).instances.tagged('delete_me').each(&:terminate) + rescue AWS::EC2::Errors::InvalidInstanceID::NotFound + # don't blow up tests if instance that we're trying to delete was not found + end end before { allow(Bosh::Clouds::Config).to receive_messages(logger: logger) }