'Sidekiq sending jobs to test queue instead of developement queue

I've added specs to cover sidekiq jobs with rspec, but now, when I start a rails server, console, or just sidekiq, I have this warning:

WARNING: Sidekiq testing API enabled, but this is not the test environment.  Your jobs will not go to Redis.

And jobs are indeed not enqueued.

How can I switch back to the development API?



Solution 1:[1]

You might want to check if you've included the gem 'rspec-sidekiq' in the group :development. If it's the case, remove it from there and only call it in the :test group.

Solution 2:[2]

Following up on Thomas answer above, if you don't find the rspec-sidekiq gem in your Gemfile, check if any part of your project code (such as a sidekiq initializer) has code like this:

 require 'sidekiq/testing'
 Sidekiq::Testing.inline!

Solution 3:[3]

I found this error when using sidekiqswarm and preloading the test gems.

Once I made the change, it worked perfect.

Before:

worker: SIDEKIQ_COUNT=5 SIDEKIQ_MAXMEM_MB=300 SIDEKIQ_PRELOAD=default,development,test sidekiqswarm -C config/sidekiq.yml

After:

worker: SIDEKIQ_COUNT=5 SIDEKIQ_MAXMEM_MB=300 SIDEKIQ_PRELOAD=default,development sidekiqswarm -C config/sidekiq.yml```

Solution 4:[4]

We had the same problem here, and since our development and test envs share the same gems in a dockerized container, we had to solve differently:

  1. Turn off auto require for rspec-sidekiq gem in Gemfile
gem "rspec-sidekiq", ~> "3.1.0", require: false
  1. Require it only on spec/rails_helper.rb
require "rspec-sidekiq"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Kelsey Hannan
Solution 3 coderberry
Solution 4 Guilherme Teodoro