Sometimes you have a test order issue CI that you want to debug locally, and to do that you need to only run the tests that knapsack runs in the relevant shard, in the right order. Here’s how to do that!
- Grab
CI_NODE_TOTALandCI_NODE_INDEXfrom the test output, it’s likely near the top:

- Grab the seed value, it’s probably going to be near the bottom of the output:

-
Run the command with the interpolated values you got above
$ RAILS_ENV=test CI=true CI_NODE_TOTAL=16 CI_NODE_INDEX=4 bundle exec rake "knapsack:rspec[--seed 43092 --format documentation]"You might also want to add
--fail-fastto the options to cut short the test suite when you hit your error:$ RAILS_ENV=test CI=true CI_NODE_TOTAL=16 CI_NODE_INDEX=4 bundle exec rake "knapsack:rspec[--seed 43092 --format documentation --fail-fast]"You can even
rspec bisectacross this set of tests:$ OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES RAILS_ENV=test CI=true CI_NODE_TOTAL=16 CI_NODE_INDEX=13 bundle exec rake "knapsack:rspec[--seed 16837 --bisect]"Here I added
OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YESas there is bug/issue with Ruby on OS X, you should be able to remove that environment variable on Linux.