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
|
@ -160,12 +160,23 @@ def test_archive_sig_404(client: TestClient):
|
|||
|
||||
|
||||
def test_metrics(client: TestClient):
|
||||
with client as request:
|
||||
resp = request.get("/metrics")
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
env = {"PROMETHEUS_MULTIPROC_DIR": tmpdir}
|
||||
with mock.patch.dict(os.environ, env):
|
||||
with client as request:
|
||||
resp = request.get("/metrics")
|
||||
assert resp.status_code == int(HTTPStatus.OK)
|
||||
assert resp.headers.get("Content-Type").startswith("text/plain")
|
||||
|
||||
|
||||
def test_disabled_metrics(client: TestClient):
|
||||
env = {"PROMETHEUS_MULTIPROC_DIR": str()}
|
||||
with mock.patch.dict(os.environ, env):
|
||||
with client as request:
|
||||
resp = request.get("/metrics")
|
||||
assert resp.status_code == int(HTTPStatus.SERVICE_UNAVAILABLE)
|
||||
|
||||
|
||||
def test_rtl(client: TestClient):
|
||||
responses = {}
|
||||
expected = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue