Skip to content

Serialize ssd_tier startup_maintenance test to kill rare OnceLock flake #117

@Pushkinist

Description

@Pushkinist

Summary

ssd_tier::tests::startup_maintenance_prunes_and_evicts_to_budget (in crates/rmlx-kv-ssd/src/ssd_tier_tests.rs) rarely fails (exit 101, ~1-in-6) under cargo test --workspace / make ci. It passes on re-run.

Cause

The process-global paths::home() OnceLock gets seeded by another test in the same test binary before this test's set_var(RMLX_HOME) runs, so home() resolves to a stale root for this test. Order-dependent across the parallel test threads → nondeterministic.

This is test-isolation only — not a product bug. #106/#111 fixed the production path (the startup_maintenance routine now takes an injected SsdKvIndex instead of calling home()), and the test passes reliably when run alone (cargo test -p rmlx-kv-ssd is 5/5 green). The residual hazard is the shared global in the --workspace test binary.

Impact

make ci may need one re-run. Annoying for a clean release gate; otherwise harmless.

Suggested fix (general)

Make the test not depend on the global home() OnceLock:

Prefer the DI approach (no new dep, matches #111).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions