Exemple #1
0
def requires_marathon_version(version):
    """This python module is for testing root and MoM marathons.   The @marathon_1_5
       annotation works only for the root marathon.   The context switching necessary
       for switching the marathons occurs after the evaluation of the pytestmark.
       This function is used to ensure the correct version of marathon regardless
       of root or mom.
    """
    # marathon version captured here will work for root and mom
    if shakedown.marthon_version_less_than(version):
        pytest.skip()
def requires_marathon_version(version):
    """This python module is for testing root and MoM marathons.   The @marathon_1_5
       annotation works only for the root marathon.   The context switching necessary
       for switching the marathons occurs after the evaluation of the pytestmark.
       This function is used to ensure the correct version of marathon regardless
       of root or mom.
    """
    # marathon version captured here will work for root and mom
    if shakedown.marthon_version_less_than(version):
        pytest.skip()
def test_https_health_check_healthy(protocol='MESOS_HTTPS'):
    """ Test HTTPS and MESOS_HTTPS protocols with a prepared nginx image that enables
        SSL (using self-signed certificate) and listens on 443
    """
    # marathon version captured here will work for root and mom
    if marthon_version_less_than('1.4.2'):
        pytest.skip()

    client = marathon.create_client()

    app_def = nginx_with_ssl_support()

    assert_app_healthy(client, app_def, health_check(protocol=protocol, port_index=1))
Exemple #4
0
def test_https_health_check_healthy(protocol='MESOS_HTTPS'):
    """ Test HTTPS and MESOS_HTTPS protocols with a prepared nginx image that enables
        SSL (using self-signed certificate) and listens on 443
    """
    # marathon version captured here will work for root and mom
    if marthon_version_less_than('1.4.2'):
        pytest.skip()

    client = marathon.create_client()

    app_def = nginx_with_ssl_support()

    assert_app_healthy(client, app_def, health_check(protocol=protocol, port_index=1))
Exemple #5
0
def test_metrics_endpoint(marathon_service_name):
    service_url = shakedown.dcos_service_url(marathon_service_name)
    response = http.get("{}metrics".format(service_url))
    assert response.status_code == 200, "HTTP status code {} is NOT 200".format(
        response.status_code)

    if marthon_version_less_than('1.7'):
        metric_name = 'service.mesosphere.marathon.app.count'
    else:
        metric_name = 'marathon.apps.active.gauge'

    response_json = response.json()
    print(response_json['gauges'])
    assert response_json['gauges'][metric_name] is not None, \
        "{} is absent".format(metric_name)