Skip to content

Fix flaky test_expiration and speed up test_persistent_cache suite - #825

Open
ptpt wants to merge 3 commits into
mainfrom
fix-ci-flaky-tests
Open

Fix flaky test_expiration and speed up test_persistent_cache suite#825
ptpt wants to merge 3 commits into
mainfrom
fix-ci-flaky-tests

Conversation

@ptpt

@ptpt ptpt commented Aug 3, 2026

Copy link
Copy Markdown
Member
  • Fix flaky test_expiration on loaded CI runners
  • Speed up test_persistent_cache stress tests (~3.3x faster)

ptpt added 2 commits August 3, 2026 15:21
The test set a cache entry with expires_in=1 and immediately read it
back. On heavily loaded runners (e.g. Windows under SQLite lock
contention) the set->get latency could exceed 1s, so the entry expired
before the immediate read and get() returned None, failing the assert.

Widen the short-expiration window to 5s so the immediate read cannot
lose the set->get race, while still validating real expiry.
The concurrency stress tests dominated the suite runtime (267s total),
with two tests alone accounting for ~74%. Reduce iteration counts while
keeping the same concurrent code paths (16-40 workers on a shared SQLite
file), so lock-contention and correctness coverage stays intact:

- multithread_shared_cache_comprehensive: num_keys 5000 -> 1000
- multiprocess_shared_cache_comprehensive: keys_per_process 1000 -> 250
- multiprocess_write_without_database_lock_errors: 10000 -> 2000 keys
- multiprocess/multithread_sqlite_database_locking: num_items 4000 -> 1000

Suite runtime: 267s -> 81s. No production code changed.
@meta-cla meta-cla Bot added the cla signed label Aug 3, 2026
The repo had no [tool.ruff] config, so 'ruff check mapillary_tools' relied
on ruff's built-in defaults. ruff is installed unpinned in CI, and newer
ruff versions expanded their default rule set (adding UP, I, BLE, SIM, PL,
etc.), which flags ~240 pre-existing issues and fails the lint step.

Add an explicit [tool.ruff.lint] select matching ruff's historical default
(E4, E7, E9, F) so linting is deterministic regardless of the installed
ruff version. No source code changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant