コード例 #1
0
    def test_failure_unauthorized(self, aggregator, instance):
        # type: (AggregatorStub, Instance) -> None
        instance = instance.copy()
        instance['password'] = '******'

        check = VoltDBCheck('voltdb', {}, [instance])

        with pytest.raises(Exception) as ctx:
            check.check(instance)
        error = str(ctx.value)
        assert '401 Client Error: Unauthorized' in error

        assertions.assert_service_checks(aggregator,
                                         instance,
                                         connect_status=VoltDBCheck.CRITICAL)
コード例 #2
0
    def test_failure_connection_refused(self, aggregator, instance):
        # type: (AggregatorStub, Instance) -> None
        instance = instance.copy()
        instance['url'] = 'http://doesnotexist:8080'

        check = VoltDBCheck('voltdb', {}, [instance])

        with pytest.raises(Exception) as ctx:
            check.check(instance)
        error = str(ctx.value)
        assert error

        tags = ['host:doesnotexist', 'port:8080']
        assertions.assert_service_checks(aggregator,
                                         instance,
                                         connect_status=VoltDBCheck.CRITICAL,
                                         tags=tags)