use fake time instead of real time when measuring against inservice_time_allowed

This commit is contained in:
Anuj Biyani 2013-06-10 14:04:15 -07:00
parent 1b5acf6ede
commit c493f2e188

View File

@ -97,20 +97,10 @@ module AwsMissingTools
@group.auto_scaling_instances.each do |instance|
time_taken = 0
begin
Timeout::timeout(@opts[:inservice_time_allowed]) do
until all_instances_inservice_for_time_period?(@group.load_balancers, INSERVICE_POLLING_TIME)
puts "#{time_taken} seconds have elapsed while waiting for all instances to be InService for a minimum of #{@opts[:min_inservice_time]} seconds."
time_taken += INSERVICE_POLLING_TIME
sleep INSERVICE_POLLING_TIME
end
puts "\nThe new instance was found to be healthy; one old instance will now be removed from the load balancers."
deregister_instance instance.ec2_instance, @group.load_balancers
end
rescue Timeout::Error => e
if time_taken >= @opts[:inservice_time_allowed]
puts "\nDuring the last #{time_taken} seconds, a new AutoScaling instance failed to become healthy."
puts "The following settings were changed and will not be changed back by this script:\n"
@ -122,7 +112,14 @@ module AwsMissingTools
end
raise
else
time_taken += INSERVICE_POLLING_TIME
sleep INSERVICE_POLLING_TIME
end
end
puts "\nThe new instance was found to be healthy; one old instance will now be removed from the load balancers."
deregister_instance instance.ec2_instance, @group.load_balancers
puts "Sleeping for the ELB Timeout period of #{@opts[:elb_timeout]}"
sleep @opts[:elb_timeout]