Example #1
0
def test_scale_new_app_instances_to_target(scale_marathon_app_instances,
                                           marathon_client, logger):
    """When scaling new instances up, if we have met or surpassed the
       amount of instances deployed for old_app, go right to our
       deployment target amount of instances for new_app
    """
    new_app = {
        'instances': 10,
        'labels': {
            'HAPROXY_DEPLOYMENT_TARGET_INSTANCES': 30
        }
    }
    old_app = {'instances': 8}
    scale_new_app_instances(logger, marathon_client, new_app, old_app)

    scale_marathon_app_instances.assert_called_with(
      marathon_client, new_app, 30)
Example #2
0
def test_scale_new_app_instances_up_50_percent(scale_marathon_app_instances,
                                               marathon_client, logger):
    """When scaling new_app instances, increase instances by 50% of
       existing instances if we have not yet met or surpassed the amount
       of instances deployed by old_app
    """
    new_app = {
        'instances': 10,
        'labels': {
            'HAPROXY_DEPLOYMENT_TARGET_INSTANCES': 30
        }
    }
    old_app = {'instances': 30}
    scale_new_app_instances(logger, marathon_client, new_app, old_app)

    scale_marathon_app_instances.assert_called_with(
      marathon_client, new_app, 15)