Ejemplo n.º 1
0
def test_version_metadata(instance, datadog_agent, dd_run_check):
    check = ClickhouseCheck('clickhouse', {}, [instance])
    check.check_id = 'test:123'
    dd_run_check(check)

    datadog_agent.assert_metadata(
        'test:123', {'version.scheme': 'calver', 'version.year': CLICKHOUSE_VERSION.split(".")[0]}
    )
def test_version_metadata(instance, datadog_agent):
    check = ClickhouseCheck('clickhouse', {}, [instance])
    check.check_id = 'test:123'
    check.run()

    datadog_agent.assert_metadata('test:123', {
        'version.scheme': 'calver',
        'version.year': CLICKHOUSE_VERSION
    })
Ejemplo n.º 3
0
def test_config(instance):
    check = ClickhouseCheck('clickhouse', {}, [instance])
    check.check_id = 'test-clickhouse'

    with mock.patch('clickhouse_driver.Client') as m:
        check.connect()
        m.assert_called_once_with(
            host=instance['server'],
            port=instance['port'],
            user=instance['user'],
            password=instance['password'],
            database='default',
            connect_timeout=10,
            send_receive_timeout=10,
            sync_request_timeout=10,
            compression=False,
            secure=False,
            settings={},
            client_name='datadog-test-clickhouse',
        )