Ejemplo n.º 1
0
def test_pool_manager_init(mock_pool_manager, mock_resource_groups):
    assert mock_pool_manager.cluster == 'mesos-test'
    assert mock_pool_manager.pool == 'bar'
    assert mock_pool_manager.scheduler == 'mesos'
    with staticconf.testing.MockConfiguration(
        {
            'scaling_limits': {
                'max_tasks_to_kill': 'inf',
                'max_weight_to_add': 100,
                'max_weight_to_remove': 100,
                'min_capacity': 3,
                'max_capacity': 3,
            },
        },
        namespace='bar.mesos_config',
    ), mock.patch(
        'clusterman.aws.spot_fleet_resource_group.SpotFleetResourceGroup.load',
        return_value={},
    ), mock.patch(
        'clusterman.autoscaler.pool_manager.DrainingClient',
        autospec=True,
    ), mock.patch(
        'clusterman.autoscaler.pool_manager.PoolManager.reload_state'
    ):
        mock_manager = PoolManager('mesos-test', 'bar', 'mesos')
        mock_manager.resource_groups = mock_resource_groups
        assert mock_manager.max_tasks_to_kill == float('inf')
Ejemplo n.º 2
0
def mock_pool_manager(mock_resource_groups):
    with mock.patch(
        'clusterman.aws.spot_fleet_resource_group.SpotFleetResourceGroup.load',
        return_value={},
    ), mock.patch(
        'clusterman.autoscaler.pool_manager.DrainingClient',
        autospec=True,
    ), mock.patch(
        'clusterman.autoscaler.pool_manager.PoolManager.reload_state'
    ), mock.patch(
        'clusterman.autoscaler.pool_manager.ClusterConnector.load',
    ):
        manager = PoolManager('mesos-test', 'bar', 'mesos')
        manager.resource_groups = mock_resource_groups

        return manager