Skip to content

Commit

Permalink
#50 - change error message on switch to account for no stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
kmanning committed Sep 26, 2016
1 parent e1ae628 commit e4588ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def kill_inactive

def switch
check_blue_green_not_both_active 'Switch'
raise ApplicationError.new('Only one color stack exists, cannot switch to a non-existent version!') unless both_stacks_exist?
raise ApplicationError.new('Both stacks must exist to switch.') unless both_stacks_exist?
cool_inactive_on_failure { swap_group true }
end

Expand Down
12 changes: 10 additions & 2 deletions spec/unit/deployment_strategy/auto_scaling_group_swap_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,11 @@
end

context 'both stacks do not exist' do
let(:error) { 'Both stacks must exist to switch.' }

context '(only green exists)' do
it 'should raise an error' do
strategy = create_strategy(green: :active, blue: :dead)
error = 'Only one color stack exists, cannot switch to a non-existent version!'

expect { strategy.switch }.to raise_error(error)
end
Expand All @@ -434,7 +435,14 @@
context '(only blue exists)' do
it 'should raise an error' do
strategy = create_strategy(green: :dead, blue: :active)
error = 'Only one color stack exists, cannot switch to a non-existent version!'

expect { strategy.switch }.to raise_error(error)
end
end

context '(no stack exists)' do
it 'should raise an error' do
strategy = create_strategy(green: :dead, blue: :dead)

expect { strategy.switch }.to raise_error(error)
end
Expand Down

0 comments on commit e4588ca

Please sign in to comment.