Knapsack: Rerun a flaky test locally

Posted . Visible to the public.

Knapsack allows you to rerun a specific job locally Show archive.org snapshot . This is helpful to run specs in the exactly same order like in the CI.

Example for running rspec 3/8 with a seed output of 20689:

CI_NODE_INDEX=2 CI_NODE_TOTAL=8 bundle exec rake "knapsack:rspec[--seed=20689]"

Note: the environment variable CI_NODE_INDEX starts at 0

As an alternative you can copy and paste the test files from both sections Report specs + Leftover specs in rspec 3/8 and run them with e.g. bundle exec --seed=20689 spec/models/user_spec.rb spec/models/post_spec.rb ....

Last edit
Emanuel
License
Source code in this card is licensed under the MIT License.
Posted by Emanuel to makandra dev (2026-01-05 10:50)