leaderboard_plugin opt-in/opt-out tests are flaky under parallel execution #5

Closed
opened 2026-05-19 18:20:48 +00:00 by funman300 · 0 comments
Owner

Description

The four leaderboard_plugin opt-in/opt-out tests fail intermittently when running the full cargo test --workspace suite in parallel, but pass 100% of the time when run in isolation:

cargo test -p solitaire_engine --lib leaderboard_plugin

Failing tests:

  • opt_in_error_fires_warning_toast
  • opt_in_success_sets_opted_in_flag
  • opt_out_error_fires_warning_toast
  • opt_out_success_clears_opted_in_flag

Likely Cause

Shared mutable state or a global resource in the test setup is not isolated between test threads. When the full workspace runs with Rust's default parallel test runner, another test in a different module appears to interfere with these tests' ECS world or resource initialisation.

Impact

Blocks cargo test --workspace from being a reliable CI gate — these tests produce false negatives on every clean run.

Suggested Fix

Audit leaderboard_plugin::tests setup for any global/static state. Consider adding #[serial_test::serial] on the affected tests, or refactoring shared setup into a per-test helper that constructs a fresh App.

## Description The four `leaderboard_plugin` opt-in/opt-out tests fail intermittently when running the full `cargo test --workspace` suite in parallel, but pass 100% of the time when run in isolation: ``` cargo test -p solitaire_engine --lib leaderboard_plugin ``` Failing tests: - `opt_in_error_fires_warning_toast` - `opt_in_success_sets_opted_in_flag` - `opt_out_error_fires_warning_toast` - `opt_out_success_clears_opted_in_flag` ## Likely Cause Shared mutable state or a global resource in the test setup is not isolated between test threads. When the full workspace runs with Rust's default parallel test runner, another test in a different module appears to interfere with these tests' ECS world or resource initialisation. ## Impact Blocks `cargo test --workspace` from being a reliable CI gate — these tests produce false negatives on every clean run. ## Suggested Fix Audit `leaderboard_plugin::tests` setup for any global/static state. Consider adding `#[serial_test::serial]` on the affected tests, or refactoring shared setup into a per-test helper that constructs a fresh `App`.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#5