suspend certain autoscaling processes before cycling servers

This commit is contained in:
Anuj Biyani
2013-05-31 15:05:16 -07:00
parent 4f466e1a19
commit 6f74b5c511
4 changed files with 26 additions and 2 deletions

View File

@@ -19,7 +19,7 @@ describe 'aws-ha-release' do
describe '#initialize' do
it 'initializes the AWS connection' do
as.groups.create 'test_group'
as.groups.create opts[:as_group_name]
AWS.should_receive(:config).with(access_key_id: 'testaccesskey', secret_access_key: 'testsecretkey', region: 'test-region')
AwsHaRelease.new(opts)
@@ -31,4 +31,17 @@ describe 'aws-ha-release' do
}.should raise_error
end
end
describe '#execute!' do
before do
as.groups.create opts[:as_group_name]
@aws_ha_release = AwsHaRelease.new(opts)
end
it 'suspends certain autoscaling processes' do
AWS::FakeAutoScaling::Group.any_instance.should_receive(:suspend_processes)
.with('ReplaceUnhealthy', 'AlarmNotification', 'ScheduledActions', 'AZRebalance')
@aws_ha_release.execute!
end
end
end

View File

@@ -26,6 +26,13 @@ module AWS
def initialize(name)
@name = name
@suspended_processes = {}
end
def suspend_processes(*processes)
processes.each do |process|
@suspended_processes[process] = 'test'
end
end
end
end