suspend certain autoscaling processes before cycling servers
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user