test: incremental coverage improvement iteration#32
test: incremental coverage improvement iteration#32unhappychoice wants to merge 49 commits intomainfrom
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 13 minutes and 16 seconds.Comment |
…mpty appids slice
…e via min_by then_with arms
…stable Tests in cache.rs, config.rs, display.rs, image_display.rs, and steam/native.rs each owned a private `static ENV_LOCK: Mutex<()>`, but they all mutate the same process-wide environment (XDG_CACHE_HOME, HOME, STEAM_API_KEY, TERM_PROGRAM, ...). Module-local mutexes don't serialize across modules, so the default parallel scheduler raced on env state — one panic poisoned a per-module ENV_LOCK and cascaded into ~10 PoisonError failures in subsequent tests. Introduce `crate::test_support::lock_env()`, a `#[cfg(test)]`-only helper that returns a guard from a single crate-wide mutex and recovers from poisoning via `unwrap_or_else(|e| e.into_inner())` — env state is restored by the existing RAII scope guards even on panic, so a poisoned lock is safe to reuse. Each test sub-module now imports `lock_env` instead of declaring its own static. `cargo test` (default parallel) now passes 266/266 across 30 consecutive runs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
cache.rs,config.rs,display.rs,image_display.rs,main.rs,steam/{client,error,models,native}.rsvia 50+ incremental commits (≈+4,250 / −22 LoC, almost entirely test code).demo_statsinsrc/main.rsis nowpub(crate)so the newmod testscan call it (the "visibility tweak" the PR description allows).#[cfg(test)] src/test_support.rsmodule exposinglock_env()— a single crate-wide mutex used by every env-mutating test sub-module, with poisoning recovered viainto_innerso a panic in one test cannot cascade-fail unrelated tests.Highlights
steam/client.rs— adds an in-process HTTP server (spawn_n_shot_server/spawn_sequential_server) to driverequest_with_retrythrough 200 / 400 / 403 / 429 / 500 / connection-refused / timeout / truncated-body / retry-then-success paths.steam/native.rs— coversNativeSteamClient::try_newNone/ load-failure /CreateInterfacesymbol-missing branches via a system-lib symlink, plusquery_cell_size_ioctlshort-circuits.config.rs/image_display.rs/display.rs/cache.rs— exercise XDG_CACHE_HOME / HOME env precedence,create_default_configparent-missing & write-failure branches,AchievementCacheserde round-trip incl. NaN/Inf, and image cache fs round-trips.main.rs— addsdemo_statsinvariants (descending playtime, achievements ≤ possible, etc.) andCliclap parsing tests.Test plan
cargo build --tests— cleancargo clippy --all-targets --all-features— cleancargo fmt -- --check— cleancargo test(default parallel scheduler) → 266 passed, 0 failed across 30 consecutive runs