def app_heartbeat(): config = flask.current_app.config results = [] try: auth_domain = config.get("AUTH_DOMAIN") r = requests.get(f"https://{auth_domain}/test") assert "clock" in r.json() except Exception: logger.info("Auth0 heartbeat error") results.append( checks.Error("Cannot connect to the mozilla auth0 service.", id="auth.auth0")) auth = get_service("auth") try: ping = auth.ping() assert ping["alive"] is True except Exception: logger.info("Taskcluster heartbeat error") results.append( checks.Error("Cannot connect to the Taskcluster service.", id="auth.taskcluster")) return results
def test_check_message(): message = checks.Error("some error", level=100, id="tests.checks.E001") assert str(message) == "?: (tests.checks.E001) some error" assert message.is_serious() obj = "test" message = checks.Error("some error", level=100, id="tests.checks.E001", obj=obj) assert str(message) == "test: (tests.checks.E001) some error" assert (repr(message) == "<Error: level=100, msg='some error', " "hint=None, obj='test', id='tests.checks.E001'>") message2 = checks.Error("some error", level=100, id="tests.checks.E001", obj=obj) assert message == message2 message3 = checks.Error("some error", level=101, id="tests.checks.E001", obj=obj) assert message != message3
def test_check_message(): message = checks.Error('some error', level=100, id='tests.checks.E001') assert str(message) == '?: (tests.checks.E001) some error' assert message.is_serious() obj = 'test' message = checks.Error('some error', level=100, id='tests.checks.E001', obj=obj) assert str(message) == 'test: (tests.checks.E001) some error' assert ( repr(message) == "<Error: level=100, msg='some error', hint=None, obj='test', id='tests.checks.E001'>" ) message2 = checks.Error('some error', level=100, id='tests.checks.E001', obj=obj) assert message == message2 message3 = checks.Error('some error', level=101, id='tests.checks.E001', obj=obj) assert message != message3
def app_heartbeat(): if current_app.config.get("PULSE_USER") and current_app.config.get("PULSE_PASSWORD"): try: current_app.pulse.ping() return [] except Exception: logger.info("Pulse heartbeat issues") return [checks.Error("Cannot connect to the pulse service.", id="pulse.ping")] # Pulse not enabled return []
def app_heartbeat(): if os.environ.get("DISABLE_PULSE"): return [] try: flask.current_app.pulse.ping() return [] except Exception: logger.info("Pulse heartbeat issues") return [ checks.Error("Cannot connect to the pulse service.", id="pulse.ping") ]
def error_check(): return [checks.Error("some error", id="tests.checks.E001")]
def error_check(): return [checks.Error('some error', id='tests.checks.E001')]