update max size if equal to desired capacity
This commit is contained in:
@@ -34,7 +34,7 @@ describe 'aws-ha-release' do
|
||||
|
||||
describe '#execute!' do
|
||||
before do
|
||||
as.groups.create opts[:as_group_name]
|
||||
@group = as.groups.create opts[:as_group_name]
|
||||
@aws_ha_release = AwsHaRelease.new(opts)
|
||||
end
|
||||
|
||||
@@ -43,5 +43,15 @@ describe 'aws-ha-release' do
|
||||
.with('ReplaceUnhealthy', 'AlarmNotification', 'ScheduledActions', 'AZRebalance')
|
||||
@aws_ha_release.execute!
|
||||
end
|
||||
|
||||
it 'adjusts the maximum size if the desired capacity is equal to it' do
|
||||
@group.update(max_size: 1, desired_capacity: 1)
|
||||
expect(@aws_ha_release.max_size_change).to eq 0
|
||||
|
||||
AWS::FakeAutoScaling::Group.any_instance.should_receive(:update).with({ max_size: 2 })
|
||||
@aws_ha_release.execute!
|
||||
|
||||
expect(@aws_ha_release.max_size_change).to eq 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,11 +22,13 @@ module AWS
|
||||
end
|
||||
|
||||
class Group
|
||||
attr_reader :name
|
||||
attr_reader :name, :max_size, :desired_capacity
|
||||
|
||||
def initialize(name)
|
||||
@name = name
|
||||
@suspended_processes = {}
|
||||
@max_size = 2
|
||||
@desired_capacity = 1
|
||||
end
|
||||
|
||||
def suspend_processes(*processes)
|
||||
@@ -34,6 +36,12 @@ module AWS
|
||||
@suspended_processes[process] = 'test'
|
||||
end
|
||||
end
|
||||
|
||||
def update(options = {})
|
||||
options.each do |key, value|
|
||||
self.instance_variable_set "@#{key}", value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user