def test_healtchcheck_and_volume():
    """Launches a Docker container on Marathon."""

    app_def = apps.healthcheck_and_volume()
    app_id = app_def["id"]

    client = marathon.create_client()
    client.add_app(app_def)
    shakedown.deployment_wait(app_id=app_id)

    tasks = client.get_tasks(app_id)
    app = client.get_app(app_id)

    assert len(
        tasks
    ) == 1, "The number of tasks is {} after deployment, but only 1 was expected".format(
        len(tasks))
    assert len(
        app['container']['volumes']
    ) == 2, "The container does not have the correct amount of volumes"

    # check if app becomes healthy
    @retrying.retry(wait_fixed=1000,
                    stop_max_attempt_number=30,
                    retry_on_exception=common.ignore_exception)
    def check_health():
        app = client.get_app(app_id)
        assert app['tasksHealthy'] == 1, "The app is not healthy"

    check_health()
def test_healtchcheck_and_volume():
    """Launches a Docker container on Marathon."""

    app_def = apps.healthcheck_and_volume()
    app_id = app_def["id"]

    client = marathon.create_client()
    client.add_app(app_def)
    deployment_wait(service_id=app_id)

    tasks = client.get_tasks(app_id)
    app = client.get_app(app_id)

    assert len(tasks) == 1, "The number of tasks is {} after deployment, but only 1 was expected".format(len(tasks))
    assert len(app['container']['volumes']) == 2, "The container does not have the correct amount of volumes"

    # check if app becomes healthy
    assert_that(lambda: client.get_app(app_id), eventually(has_value('tasksHealthy', 1), max_attempts=30))
示例#3
0
def test_healtchcheck_and_volume():
    """Launches a Docker container on Marathon."""

    app_def = apps.healthcheck_and_volume()
    app_id = app_def["id"]

    client = marathon.create_client()
    client.add_app(app_def)
    common.deployment_wait(service_id=app_id)

    tasks = client.get_tasks(app_id)
    app = client.get_app(app_id)

    assert len(tasks) == 1, "The number of tasks is {} after deployment, but only 1 was expected".format(len(tasks))
    assert len(app['container']['volumes']) == 2, "The container does not have the correct amount of volumes"

    # check if app becomes healthy
    assert_that(lambda: client.get_app(app_id), eventually(has_value('tasksHealthy', 1), max_attempts=30))
示例#4
0
def test_healtchcheck_and_volume():
    """Launches a Docker container on Marathon."""

    app_def = apps.healthcheck_and_volume()
    app_id = app_def["id"]

    client = marathon.create_client()
    client.add_app(app_def)
    shakedown.deployment_wait(app_id=app_id)

    tasks = client.get_tasks(app_id)
    app = client.get_app(app_id)

    assert len(tasks) == 1, "The number of tasks is {} after deployment, but only 1 was expected".format(len(tasks))
    assert len(app['container']['volumes']) == 2, "The container does not have the correct amount of volumes"

    # check if app becomes healthy
    @retrying.retry(wait_fixed=1000, stop_max_attempt_number=30, retry_on_exception=common.ignore_exception)
    def check_health():
        app = client.get_app(app_id)
        assert app['tasksHealthy'] == 1, "The app is not healthy"

    check_health()