FAQ / knapsack_pro / Queue Mode problems & solutions for knapsack_pro gem

Why when I use Queue Mode for RSpec then my tests fail?

knapsack_pro Queue Mode uses RSpec::Core::Runner feature that allows running specs multiple times with different runner options in the same process. Thanks to that we can run subset of test suite pulled from Knapsack Pro API work queue. This allows dynamic allocation of your tests across CI nodes without reloading whole Ruby/Rails application for each run of test suite subset.

If you have custom things that are not common in how typical RSpec spec looks like then the RSpec feature won't be able to handle it between test suite subset runs. In that case you need to resolve failed tests in a way that allows RSpec to run the tests. Feel free to ask me for help.

You can learn more about recent RSpec team changes that was backported into knapsack_pro.

To solve failing tests in Queue Mode you can check:

  • you use full namespacing. If you see error like NameError: uninitialized constant MyModule::ModelName then in some cases a top-level constant would be matched if the code hadn't been loaded for the scoped constant. Try to use full namespacing ::SomeModule::MyModule::ModelName etc.
  • you can try to use binary version of knapsack_pro instead of running it via rake task. This helps if your rake tasks mess up with tests and make knapsack_pro Queue Mode fail. See example:

    
    # Knapsack Pro Queue Mode run via binary
    bundle exec knapsack_pro queue:rspec "--profile 10 --format progress"
    
    
  • You can check below questions for common reasons of failing tests in Queue Mode

# Queue Mode problems & solutions for knapsack_pro gem
See questions outside of this category

Start using Knapsack Pro

Sign up and speed up your tests.