fix(tests): reset the latest-grid TTL cache between tests#110
Merged
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/v1/mrms/latestwhilemrms_gridswas 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_gridplus three tile tests (missingx-aeroza-grid-key/x-aeroza-tile-cacheheaders).reset_latest_grid_cache()toaeroza/query/mrms_grids.pyand an autouse conftest fixture that clears the cache (and per-key locks) around every test.Test plan
postgis/postgis:16-3.5on unpatched main (same assertion as CI)🤖 Generated with Claude Code