Isolate the access log in tests so self-test traffic doesn't pollute the live monitor (#168)

conftest redirected AUDIT_DIR and ERROR_DIR to a throwaway tmp dir but left
ACCESS_DIR pointing at the repo's logs/access/. The request-logging middleware
runs under TestClient too, so every suite run appended its deliberate error-path
requests (401/404/409/422/502/503) to the live access log that the ops
dashboard reads, inflating its traffic and error tallies. Point ACCESS_DIR at
the tmp dir like the other two.

Co-authored-by: root <root@vmi3417050.contaboserver.net>
This commit is contained in:
Emi Griffith 2026-07-17 12:44:30 -07:00 committed by GitHub
parent 956153691a
commit c5017bf5eb

View file

@ -41,6 +41,9 @@ import audit # noqa: E402
audit.AUDIT_DIR = os.path.join(_TMP, "logs", "audit")
audit.ERROR_DIR = os.path.join(_TMP, "logs", "errors")
# The request-logging middleware runs under TestClient too; keep its access log
# out of the repo's logs/ so self-test traffic never pollutes the live monitor.
audit.ACCESS_DIR = os.path.join(_TMP, "logs", "access")
def _years_before(d: datetime.date, years: int) -> datetime.date: