diff --git a/License2Deploy/rolling_deploy.py b/License2Deploy/rolling_deploy.py index 83a005e..416e3e2 100644 --- a/License2Deploy/rolling_deploy.py +++ b/License2Deploy/rolling_deploy.py @@ -182,7 +182,7 @@ def lb_healthcheck(self, new_ids, attempt=0, wait_time=0): logging.info('ELB healthcheck OK') return True - def confirm_lb_has_only_new_instances(self, wait_time=60): + def confirm_lb_has_only_new_instances(self, wait_time=120): ''' Confirm that only new instances with the current build tag are in the load balancer ''' sleep(wait_time) # Allotting time for the instances to shut down instance_ids = self.conn_elb.describe_instance_health(self.load_balancer) diff --git a/tests/rolling_deploy_test.py b/tests/rolling_deploy_test.py index 4cc6ba6..d5eb6bb 100644 --- a/tests/rolling_deploy_test.py +++ b/tests/rolling_deploy_test.py @@ -35,7 +35,7 @@ def get_autoscaling_configurations(self, launch_configuration_name, autoscaling_ } @mock_autoscaling - def setUpAutoScaleGroup(self, configurations): + def setUpAutoScaleGroup(self, configurations, env="stg"): conn = boto.connect_autoscale() for configuration in configurations: config = LaunchConfiguration( @@ -43,6 +43,7 @@ def setUpAutoScaleGroup(self, configurations): image_id='ami-abcd1234', instance_type='m1.medium', ) + load_balancer_name = 'servergmsextenderELB{0}'.format(env) group = AutoScalingGroup( name=configuration[self.autoscaling_group_name], availability_zones=['us-east-1a'], @@ -53,7 +54,7 @@ def setUpAutoScaleGroup(self, configurations): max_size=10, min_size=2, launch_config=config, - load_balancers=['servergmsextenderELBstg'], + load_balancers=[load_balancer_name], vpc_zone_identifier='subnet-1234abcd', termination_policies=["Default"], ) @@ -185,9 +186,8 @@ def test_get_autoscale_group_name_prd(self): self.setUpELB(env='prd') self.rolling_deploy = RollingDeploy('prd', 'server-gms-extender', '0', 'ami-test212', None, './regions.yml') autoscaling_configurations = list() - autoscaling_configurations.append(self.get_autoscaling_configurations(self.GMS_LAUNCH_CONFIGURATION_STG, self.GMS_AUTOSCALING_GROUP_STG)) autoscaling_configurations.append(self.get_autoscaling_configurations(self.GMS_LAUNCH_CONFIGURATION_PRD, self.GMS_AUTOSCALING_GROUP_PRD)) - self.setUpAutoScaleGroup(autoscaling_configurations) + self.setUpAutoScaleGroup(autoscaling_configurations, env='prd') group = self.rolling_deploy.get_autoscale_group_name() self.assertEqual(group, self.GMS_AUTOSCALING_GROUP_PRD) self.assertNotEqual(group, self.GMS_AUTOSCALING_GROUP_STG) @@ -215,6 +215,7 @@ def test_get_instance_ip_addrs(self): @mock_autoscaling @mock_elb def test_get_all_instance_ids(self): + self.setUpELB(env='stg') self.setUpAutoScaleGroup([self.get_autoscaling_configurations(self.GMS_LAUNCH_CONFIGURATION_STG, self.GMS_AUTOSCALING_GROUP_STG)]) conn = boto.connect_ec2() reservation = conn.run_instances('ami-1234abcd', min_count=2, private_ip_address="10.10.10.10")