Skip to content

fix(tests): reset the latest-grid TTL cache between tests#110

Merged
erichare merged 1 commit into
mainfrom
fix/latest-grid-cache-test-isolation
Jun 10, 2026
Merged

fix(tests): reset the latest-grid TTL cache between tests#110
erichare merged 1 commit into
mainfrom
fix/latest-grid-cache-test-isolation

Conversation

@erichare

Copy link
Copy Markdown
Owner

Summary

  • CI (and main) has been red since ee76444 / fix(db): cache latest-grid lookup to stop pooler exhaustion (EMAXCONNSESSION 500s) #108: the in-process latest-grid TTL cache introduced there is module-level state shared across the whole pytest process. A test that hit /v1/mrms/latest while mrms_grids was empty cached the miss, and any test inside the 8s TTL window that seeded a grid and expected to see it got a stale 404 — test_latest_returns_newest_materialised_grid plus three tile tests (missing x-aeroza-grid-key / x-aeroza-tile-cache headers).
  • Adds reset_latest_grid_cache() to aeroza/query/mrms_grids.py and an autouse conftest fixture that clears the cache (and per-key locks) around every test.
  • No production behavior change — the cache itself is untouched at runtime.

Test plan

  • Reproduced the failure locally against postgis/postgis:16-3.5 on unpatched main (same assertion as CI)
  • With the fix: targeted MRMS files 47 passed, full suite 844 passed, 3 skipped (eccodes-only)
  • ruff check + format, mypy clean
  • CI green

🤖 Generated with Claude Code

CI has been red since ee76444: the in-process latest-grid cache added
there is module-level state shared across the whole pytest process, so
a test that hit /v1/mrms/latest while mrms_grids was empty cached the
miss, and every test inside the 8s TTL window that seeded a grid and
expected to see it got a stale 404 (test_latest_returns_newest_
materialised_grid and three tile tests: missing x-aeroza-grid-key /
x-aeroza-tile-cache headers).

Add reset_latest_grid_cache() and an autouse fixture that clears the
cache (and per-key locks) around every test. Reproduced the failure
locally against postgis:16-3.5, then verified: 844 passed, 3 skipped
(eccodes-only); ruff + mypy clean.
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
aeroza-web Ready Ready Preview, Comment Jun 10, 2026 2:49pm

Request Review

@erichare erichare merged commit 5443fe1 into main Jun 10, 2026
9 checks passed
@erichare erichare deleted the fix/latest-grid-cache-test-isolation branch June 10, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant