#30184·fastlane

Test suite is order-dependent, which blocks parallelising it

Author: lacostejCreated Sep 9, 2026Updated Sep 11, 2026

Running specs in a random order fails today, and that blocks any move to parallel execution.

bundle exec rspec spaceship/spec --order random
915 examples, 17 failures

The failures are all variations of one thing:

#<Double "portal_client"> was originally created in one example but has leaked into
another example and can no longer be used.
# spaceship/lib/spaceship/connect_api/spaceship.rb:28:in 'Spaceship::ConnectAPI.client'

Spaceship::ConnectAPI.client memoises a module-level singleton that ends up holding an rspec double created in an earlier example, so whether a file passes depends on what ran before it. rake test_all_individually exists to find this class of problem.

Why it matters now: splitting the 448 spec files across 4 processes takes the suite from 236s to 81s, a 2.9x saving, but produces 16 failures beyond the baseline. Every one of them is this leak, not a parallelism bug — the same failures reproduce in a single process with --order random.

Suggested first step: run CI with --order random and fix what it surfaces. Parallel execution can follow safely afterwards.

All timings above are from a single local machine (macOS, Ruby 4.0.5, 4 worker processes chosen arbitrarily), not from CI. Treat the ratio as indicative rather than the absolute numbers.