def test_run(benchmark, instance):
    check = CockroachdbCheck('cockroachdb', {}, [instance])

    # Run once to get instantiation of config out of the way.
    check.check(instance)

    benchmark(check.check, instance)
def test_version_metadata(aggregator, instance, datadog_agent):

    check_instance = CockroachdbCheck('cockroachdb', {}, [instance])
    check_instance.check_id = 'test:123'
    check_instance.check(instance)

    if COCKROACHDB_VERSION == 'latest':
        m = aggregator._metrics['cockroachdb.build.timestamp'][0]
        # extract version from tags that looks like this: ['tag:v19.2.4', 'go_version:go1.12.12']
        version_label = [t for t in m.tags if 'tag' in t]
        assert len(version_label) == 1
        raw_version = version_label[0].split(':', 1)[1]
    else:
        raw_version = COCKROACHDB_VERSION

    major, minor, patch = raw_version.split('.')
    version_metadata = {
        'version.scheme': 'semver',
        'version.major': major.lstrip('v'),
        'version.minor': minor,
        'version.patch': patch,
        'version.raw': raw_version,
    }

    datadog_agent.assert_metadata('test:123', version_metadata)
Example #3
0
def test_check(aggregator, instance):
    check = CockroachdbCheck('cockroachdb', {}, {}, [instance])
    check.check(instance)

    for metric in itervalues(METRIC_MAP):
        try:
            aggregator.assert_metric(metric)
        except AssertionError:
            pass

    assert aggregator.metrics_asserted_pct > 80
Example #4
0
def test_metrics(aggregator, instance, dd_run_check):
    check = CockroachdbCheck('cockroachdb', {}, [instance])
    dd_run_check(check)

    assert_metrics(aggregator)
def test_integration(aggregator, instance):
    check = CockroachdbCheck('cockroachdb', {}, [instance])
    check.check(instance)

    _test_check(aggregator)
Example #6
0
def test_integration(aggregator, instance_legacy, dd_run_check):
    check = CockroachdbCheck('cockroachdb', {}, [instance_legacy])
    dd_run_check(check)

    _test_check(aggregator)