def test_unhealthy_terminating(self): logger.debug('TestGetInstanceStatus.test_unhealthy_terminating') self.mock_resp['HealthStatus'] = 'UNHEALTHY' self.mock_resp['LifecycleState'] = 'Terminating' asg_helper.autoscaling = Mock(**self.mock_attrs) res = asg_helper.get_instance_status(self.instance_id) self.assertEqual(res, strs.asg_instance_terminated)
def test_unhealthy_inservice(self): logger.debug('TestGetInstanceStatus.test_unhealthy_inservice') self.mock_resp['HealthStatus'] = 'UNHEALTHY' asg_helper.autoscaling = Mock(**self.mock_attrs) res = asg_helper.get_instance_status(self.instance_id) self.assertEqual(res, strs.asg_instance_pending)
def test_healthy_pending(self): logger.debug('TestGetInstanceStatus.test_healthy_pending') self.mock_resp['LifecycleState'] = 'Pending' asg_helper.autoscaling = Mock(**self.mock_attrs) res = asg_helper.get_instance_status(self.instance_id) self.assertEqual(res, strs.asg_instance_pending)
def test_healthy_inservice(self): logger.debug('TestGetInstanceStatus.test_healthy_inservice') asg_helper.autoscaling = Mock(**self.mock_attrs) res = asg_helper.get_instance_status(self.instance_id) self.assertEqual(res, strs.asg_instance_healthy)
def test_unknown_instance(self): logger.debug('TestGetInstanceStatus.test_unknown_instance') self.mock_attrs['describe_auto_scaling_instances.return_value'] = {'AutoScalingInstances': []} asg_helper.autoscaling = Mock(**self.mock_attrs) res = asg_helper.get_instance_status(self.instance_id) self.assertEqual(res, strs.asg_instance_terminated)
def test_protected_from_scalein(self): logger.debug('TestGetInstanceStatus.test_protected_from_scalein') self.mock_resp['ProtectedFromScaleIn'] = True asg_helper.autoscaling = Mock(**self.mock_attrs) res = asg_helper.get_instance_status(self.instance_id) self.assertEqual(res, strs.asg_instance_protected)
def test_healthy_entering_standby(self): logger.debug('TestGetInstanceStatus.test_healthy_entering_standby') self.mock_resp['LifecycleState'] = 'EnteringStandby' asg_helper.autoscaling = Mock(**self.mock_attrs) res = asg_helper.get_instance_status(self.instance_id) self.assertEqual(res, strs.asg_instance_protected)