Reputation: 6870
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?
Upvotes: 12
Views: 5676
Reputation: 31
Also look for require 'sidekiq/testing/inline' in the initializer files and/or environment specific files, like config/environments/development.rb –
This works for me
Upvotes: 0
Reputation: 56
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:
gem "rspec-sidekiq", ~> "3.1.0", require: false
spec/rails_helper.rb
require "rspec-sidekiq"
Upvotes: 1
Reputation: 2957
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!
Upvotes: 1
Reputation: 3160
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```
Upvotes: 0
Reputation: 336
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.
Upvotes: 29