Ejemplo n.º 1
0
def test_basic_check(aggregator):
    instance = common.MINIMAL_INSTANCE
    c = AspdotnetCheck('aspdotnet', {}, [instance])
    c.check(instance)

    for metric in common.ASP_METRICS:
        aggregator.assert_metric(metric, tags=None, count=1)

    for metric in common.ASP_APP_METRICS:
        for i in common.ASP_APP_INSTANCES:
            aggregator.assert_metric(metric, tags=["instance:%s" % i], count=1)

    assert aggregator.metrics_asserted_pct == 100.0
Ejemplo n.º 2
0
def test_basic_check(Aggregator, pdh_mocks_fixture):
    initialize_pdh_tests()
    instance = MINIMAL_INSTANCE
    c = AspdotnetCheck(CHECK_NAME, {}, {}, [instance])
    c.check(instance)

    for metric in ASP_METRICS:
        Aggregator.assert_metric(metric, tags=None, count=1)

    for metric in ASP_APP_METRICS:
        for i in ASP_APP_INSTANCES:
            Aggregator.assert_metric(metric, tags=["instance:%s" % i], count=1)

    assert Aggregator.metrics_asserted_pct == 100.0
Ejemplo n.º 3
0
def test_with_tags(Aggregator, pdh_mocks_fixture):  # noqa: F811
    initialize_pdh_tests()
    instance = INSTANCE_WITH_TAGS
    c = AspdotnetCheck(CHECK_NAME, {}, {}, [instance])
    c.check(instance)

    for metric in ASP_METRICS:
        Aggregator.assert_metric(metric, tags=['tag1', 'another:tag'], count=1)

    for metric in ASP_APP_METRICS:
        for i in ASP_APP_INSTANCES:
            Aggregator.assert_metric(metric, tags=['tag1', 'another:tag', "instance:%s" % i], count=1)

    assert aggregator.metrics_asserted_pct == 100.0
Ejemplo n.º 4
0
def test_with_tags(aggregator):
    instance = common.INSTANCE_WITH_TAGS
    c = AspdotnetCheck('aspdotnet', {}, [instance])
    c.check(instance)

    for metric in common.ASP_METRICS:
        aggregator.assert_metric(metric, tags=['tag1', 'another:tag'], count=1)

    for metric in common.ASP_APP_METRICS:
        for i in common.ASP_APP_INSTANCES:
            aggregator.assert_metric(
                metric,
                tags=['tag1', 'another:tag',
                      "instance:%s" % i],
                count=1)

    assert aggregator.metrics_asserted_pct == 100.0
Ejemplo n.º 5
0
def test(aggregator, dd_default_hostname, dd_run_check,
         mock_performance_objects):
    mock_performance_objects(PERFORMANCE_OBJECTS)
    check = AspdotnetCheck('aspdotnet', {}, [{'host': dd_default_hostname}])
    check.hostname = dd_default_hostname
    dd_run_check(check)

    global_tags = ['server:{}'.format(dd_default_hostname)]
    aggregator.assert_service_check('aspdotnet.windows.perf.health',
                                    ServiceCheck.OK,
                                    count=1,
                                    tags=global_tags)

    for metric in ASP_METRICS:
        aggregator.assert_metric(metric, 9000, count=1, tags=global_tags)

    for metric in ASP_APP_METRICS:
        for instance in ASP_APP_INSTANCES[1:]:
            tags = ['instance:{}'.format(instance)]
            tags.extend(global_tags)
            aggregator.assert_metric(metric, 9000, count=1, tags=tags)

    aggregator.assert_all_metrics_covered()
    aggregator.assert_metrics_using_metadata(get_metadata_metrics())