Ejemplo n.º 1
0
def test_update_jobs_fleet_containers__increase(mocker):
	max_cnts = 3
	min_cnts = 0
	mocker.patch.object(fleet_manager, 'ecs')
	mocker.patch.object(fleet_manager, 'calculate_optimal_job_container_capacity')
	
	fleet_manager.ecs.get_service_capacity.return_value = 0
	fleet_manager.calculate_optimal_job_container_capacity.return_value = 2

	fleet_manager.update_jobs_fleet_containers('TestCluster', 'TestService', max_cnts, min_cnts, 30)
	
	fleet_manager.ecs.set_service_capacity.assert_called_with('TestCluster', 'TestService', 1)
Ejemplo n.º 2
0
def test_update_jobs_fleet_containers__decrease_under_min(mocker):
	max_cnts = 2
	min_cnts = 1
	mocker.patch.object(fleet_manager, 'ecs')
	mocker.patch.object(fleet_manager, 'calculate_optimal_job_container_capacity')

	fleet_manager.ecs.get_service_capacity.return_value = 1
	fleet_manager.calculate_optimal_job_container_capacity.return_value = 0

	fleet_manager.update_jobs_fleet_containers('TestCluster', 'TestService', max_cnts, 
		min_cnts, mock.ANY)

	fleet_manager.ecs.set_service_capacity.assert_not_called()
Ejemplo n.º 3
0
def test_update_jobs_fleet_containers(mocker, test_type, cur_cnts, opt_cnts, expected):
	max_cnts = 2
	min_cnts = 1
	mocker.patch.object(fleet_manager, 'ecs')
	mocker.patch.object(fleet_manager, 'calculate_optimal_job_container_capacity')

	fleet_manager.ecs.get_service_capacity.return_value = cur_cnts
	fleet_manager.calculate_optimal_job_container_capacity.return_value = opt_cnts

	assert fleet_manager.update_jobs_fleet_containers('TestCluster', 'TestService', max_cnts, 
		min_cnts, mock.ANY) == expected