コード例 #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 marathon_version_less_than(version):
        pytest.skip()
コード例 #2
0
def test_metrics_endpoint(marathon_service_name):
    service_url = 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 marathon_version_less_than('1.7'):
        metric_name = 'service.mesosphere.marathon.app.count'
    else:
        metric_name = 'marathon.apps.active.gauge'

    response_json = response.json()
    logger.info('Found metric gauges: '.format(response_json['gauges']))
    assert response_json['gauges'][metric_name] is not None, \
        "{} is absent".format(metric_name)