Beispiel #1
0
    def test_failure(self, instance, datadog_agent):
        # type: (Instance, DatadogAgentStub) -> None
        def app():
            raise ValueError('Oops!')

        check_id = 'test'
        check = VoltDBCheck('voltdb', {}, [instance])
        check.check_id = check_id
        check._client = MockSysInfoClient(check._client, app)
        error = check.run()
        assert 'Oops!' in error
        datadog_agent.assert_metadata(check_id, {})
Beispiel #2
0
    def test_no_version_column(self, aggregator, instance, datadog_agent):
        # type: (AggregatorStub, Instance, DatadogAgentStub) -> None
        def app():
            r = mock.MagicMock()
            r.json.return_value = {
                'results': [{
                    'data': [('0', 'THIS_IS_NOT_VERSION', 'test')]
                }]
            }
            return r

        check_id = 'test'
        check = VoltDBCheck('voltdb', {}, [instance])
        check.check_id = check_id
        check._client = MockSysInfoClient(check._client, app)
        error = check.run()
        assert not error
        datadog_agent.assert_metadata(check_id, {})
Beispiel #3
0
    def test_malformed(self, instance, datadog_agent):
        # type: (Instance, DatadogAgentStub) -> None
        def app():
            r = mock.MagicMock()
            r.json.return_value = {
                'results': [{
                    'data': [('0', 'VERSION', 'not_a_version_string')]
                }]
            }
            return r

        check_id = 'test'
        check = VoltDBCheck('voltdb', {}, [instance])
        check.check_id = check_id
        check._client = MockSysInfoClient(check._client, app)
        error = check.run()
        assert not error
        datadog_agent.assert_metadata(check_id, {})