def test_calc_auto_scaling_recommendation_3(self): '''WHEN new capacity is lower than current capacity THEN recommend a change to the lower capacity''' result = batch_autoscaling.calc_auto_scaling_recommendation( pending_jobs_counts={'RUNNABLE': 1}, current_vcpu_min=30, current_vcpu_max=40, job_vcpus=12, scaling_permission=True) self.assertEqual(result, {'change': True, 'new_vcpu_min': 12})
def test_calc_auto_scaling_recommendation_5(self): '''WHEN scaling permission is not set THEN do not recommend a change''' result = batch_autoscaling.calc_auto_scaling_recommendation( pending_jobs_counts={ 'RUNNABLE': 3, 'STARTING': 4, 'RUNNING': 12 }, current_vcpu_min=12, current_vcpu_max=40, job_vcpus=12, scaling_permission=False) self.assertEqual(result, {'change': False, 'new_vcpu_min': 40})
def test_calc_auto_scaling_recommendation_4(self): '''WHEN total pending jobs exceed max capacity AND capacity is lower THEN recommend a change to capped to the maximum capacity''' result = batch_autoscaling.calc_auto_scaling_recommendation( pending_jobs_counts={ 'RUNNABLE': 3, 'STARTING': 4, 'RUNNING': 12 }, current_vcpu_min=12, current_vcpu_max=40, job_vcpus=12, scaling_permission=True) self.assertEqual(result, {'change': True, 'new_vcpu_min': 40})
def test_calc_auto_scaling_recommendation_1(self): '''WHEN new capacity is same as current capacity THEN do not recommend a change''' result = batch_autoscaling.calc_auto_scaling_recommendation( pending_jobs_counts={ 'RUNNABLE': 1, 'STARTING': 1, 'RUNNING': 1 }, current_vcpu_min=36, current_vcpu_max=40, job_vcpus=12, scaling_permission=True) self.assertEqual(result, {'change': False, 'new_vcpu_min': 36})