11

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?

Graham Slick
  • 6,692
  • 9
  • 51
  • 87

4 Answers4

27

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.

Thomas Geider
  • 316
  • 3
  • 7
1

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!
Kelsey Hannan
  • 2,857
  • 2
  • 30
  • 46
1

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"
0

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```
coderberry
  • 3,040
  • 3
  • 26
  • 28