-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sidekiq::Status tries to connect to Redis in RSpec #41
Comments
I have the same problem, if I remove the include in my Job of Sidekiq Status it works |
Found the problem, somehow the sidekiq-status module is required after requiring This solutions works, but I think is a temporary solution:
config.before(:suite) { require 'sidekiq-status/testing/inline' } |
This wasn't working for me, instead I've completely removed the middleware from my test environment. Here's what my Sidekiq initializer looks like: require "sidekiq"
require "sidekiq-status"
Sidekiq.configure_client do |config|
break if Rails.env.test?
Sidekiq::Status.configure_client_middleware config, expiration: 60.minutes.to_i
end
Sidekiq.configure_server do |config|
break if Rails.env.test?
Sidekiq::Status.configure_server_middleware config, expiration: 60.minutes.to_i
Sidekiq::Status.configure_client_middleware config, expiration: 60.minutes.to_i
end |
@angusm73 this is actually a good solution. we still need to figure out why is this happening though |
Ruby version: 3.0.1
Rails version: 7.0.7
Sidekiq / Pro / Enterprise version(s): 7.1.3
sidekiq initializer:
After updating from Sidekiq 6 to Sidekiq 7, running sidekiq worker tests with RSpec that involve using
Sidekiq::Status
orSidekiq::Batch
modules are failing because they are trying to connect to a redis server (which should not happen in RSpec, and also confirmed that in Sidekiq 6 it works as expected).Even trying to put the
Sidekiq::Status.configure_client_middleware
line in the sidekiq initializer (commented for now) and trying to run a RSpec test with sidekiq will result into the following error:If I comment that line then the initializer runs successfully, but then it will fail where I use
Sidekiq::Status
orSidekiq::Batch
in the workers that are being tested. ForSidekiq::Batch
I found a workaround withrspec-sidekiq
, but I can't find one to preventSidekiq::Status
to connect to redis server.I'm using the latest
sidekiq-status
, 3.0.3, and we really want to upgrade the Sidekiq gem from 6 to 7, so any help would be appreciated, thank you!The text was updated successfully, but these errors were encountered: