Exemple #1
0
 def test_protected_instance_is_detaching(self):
     logger.debug('TestNotEnoughProtectedInstances.test_no_instances')
     self.mock_attrs['describe_auto_scaling_groups.return_value']['AutoScalingGroups'][0]['Instances'][0]['ProtectedFromScaleIn'] = True
     self.mock_attrs['describe_auto_scaling_groups.return_value']['AutoScalingGroups'][0]['Instances'][0]['LifecycleState'] = 'Detaching'
     asg_helper.autoscaling = Mock(**self.mock_attrs)
     res = asg_helper.not_enough_protected_instances(self.asg_name, self.min_protected)
     self.assertTrue(res)
Exemple #2
0
 def test_min_protected_is_zero(self):
     logger.debug('TestNotEnoughProtectedInstances.test_no_instances')
     asg_helper.autoscaling = Mock(**self.mock_attrs)
     res = asg_helper.not_enough_protected_instances(self.asg_name, 0)
     self.assertFalse(res)
Exemple #3
0
 def test_no_instances(self):
     logger.debug('TestNotEnoughProtectedInstances.test_no_instances')
     self.mock_attrs['describe_auto_scaling_groups.return_value']['AutoScalingGroups'][0]['Instances'] = []
     asg_helper.autoscaling = Mock(**self.mock_attrs)
     res = asg_helper.not_enough_protected_instances(self.asg_name, self.min_protected)
     self.assertFalse(res)
Exemple #4
0
 def test_instance_needs_protection(self):
     logger.debug('TestNotEnoughProtectedInstances.test_instance_needs_protection')
     asg_helper.autoscaling = Mock(**self.mock_attrs)
     res = asg_helper.not_enough_protected_instances(self.asg_name, self.min_protected)
     self.assertTrue(res)