mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
change: log out details about PROMETHEUS_MULTIPROC_DIR
Additionally, respond with a 503 if the var is not set when /metrics is requested. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
388e64d0af
commit
c83c5cdc42
4 changed files with 35 additions and 5 deletions
|
@ -104,6 +104,17 @@ async def test_asgi_app_unsupported_backends():
|
|||
await aurweb.asgi.app_startup()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_asgi_app_disabled_metrics(caplog: pytest.LogCaptureFixture):
|
||||
env = {"PROMETHEUS_MULTIPROC_DIR": str()}
|
||||
with mock.patch.dict(os.environ, env):
|
||||
await aurweb.asgi.app_startup()
|
||||
|
||||
expected = ("$PROMETHEUS_MULTIPROC_DIR is not set, the /metrics "
|
||||
"endpoint is disabled.")
|
||||
assert expected in caplog.text
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def use_traceback():
|
||||
config_getboolean = aurweb.config.getboolean
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue