コード例 #1
0
def test_collect_metadata_invalid_binary(datadog_agent, instance):
    instance['fluentd'] = '/bin/does_not_exist'

    check = Fluentd(CHECK_NAME, {}, [instance])
    check.check_id = CHECK_ID
    check.check(instance)

    datadog_agent.assert_metadata(CHECK_ID, {})
    datadog_agent.assert_metadata_count(0)
コード例 #2
0
def test_collect_metadata_missing_version(aggregator, datadog_agent, dd_run_check, instance):
    instance["fluentd"] = "python {} 'fluentd not.a.version'".format(VERSION_MOCK_SCRIPT)

    check = Fluentd(CHECK_NAME, {}, [instance])
    check.check_id = CHECK_ID
    dd_run_check(check)

    datadog_agent.assert_metadata(CHECK_ID, {})
    datadog_agent.assert_metadata_count(0)
コード例 #3
0
def test_collect_metadata_invalid_binary_with_endpoint(datadog_agent, instance):
    instance['fluentd'] = '/bin/does_not_exist'

    check = Fluentd(CHECK_NAME, {}, [instance])
    check.check_id = CHECK_ID
    check.check(None)

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

    datadog_agent.assert_metadata(CHECK_ID, version_metadata)
    datadog_agent.assert_metadata_count(5)
コード例 #4
0
def test_collect_metadata_instance(aggregator, datadog_agent, instance, dd_run_check):
    instance['fluentd'] = 'docker exec {} fluentd'.format(FLUENTD_CONTAINER_NAME)

    check = Fluentd(CHECK_NAME, {}, [instance])
    check.check_id = CHECK_ID
    dd_run_check(check)

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

    datadog_agent.assert_metadata(CHECK_ID, version_metadata)
    datadog_agent.assert_metadata_count(5)