Skip to content

Replace deprecated Sidekiq testing API with new Sidekiq 8.1+ API#1011

Open
mattmenefee wants to merge 1 commit intotoptal:masterfrom
mattmenefee:replace-deprecated-sidekiq-testing-API
Open

Replace deprecated Sidekiq testing API with new Sidekiq 8.1+ API#1011
mattmenefee wants to merge 1 commit intotoptal:masterfrom
mattmenefee:replace-deprecated-sidekiq-testing-API

Conversation

@mattmenefee
Copy link
Contributor

@mattmenefee mattmenefee commented Mar 18, 2026

Summary

  • Centralize Sidekiq.testing!(:fake) in spec_helper.rb instead of repeating require 'sidekiq/testing' in each spec file
  • Replace Sidekiq::Testing.inline! blocks with Sidekiq.testing!(:inline) blocks
  • Silence Sidekiq logger during spec runs to reduce noise
  • Aligns with the new testing API introduced in Sidekiq 8.1+

Builds on the approach from #999 (centralized setup + logger silencing) and adds the Sidekiq::Testing.inline! migration that PR didn't cover.

Test plan

  • Verify all Sidekiq strategy specs pass (bundle exec rspec spec/chewy/strategy/sidekiq_spec.rb spec/chewy/strategy/lazy_sidekiq_spec.rb spec/chewy/strategy/delayed_sidekiq_spec.rb spec/chewy/strategy/delayed_sidekiq/scheduler_spec.rb spec/chewy/strategy/delayed_sidekiq/worker_spec.rb)
  • Confirm no remaining references to deprecated Sidekiq::Testing API

@mattmenefee mattmenefee requested a review from a team as a code owner March 18, 2026 14:55
@mattmenefee mattmenefee force-pushed the replace-deprecated-sidekiq-testing-API branch 3 times, most recently from 6d31f1a to 37bfad4 Compare March 18, 2026 15:35
`require "sidekiq/testing"` is deprecated and will be removed in
Sidekiq 9.0. The new API makes test mode activation explicit:

- `require 'sidekiq/testing'` → `Sidekiq.testing!(:fake)`
- `Sidekiq::Testing.inline! { }` → `Sidekiq.testing!(:inline) { }`

Centralize the fake mode activation in spec_helper.rb rather than
repeating it in each spec file, and silence the Sidekiq logger
during test runs to reduce noise.

Co-authored-by: Matt Jankowski <matt@jankowski.online>
@mattmenefee mattmenefee force-pushed the replace-deprecated-sidekiq-testing-API branch from 37bfad4 to 0ae9636 Compare March 18, 2026 16:21
@mattmenefee
Copy link
Contributor Author

mattmenefee commented Mar 18, 2026

Apologies @mjankowski! I didn't see #999 before opening this PR. I've updated this to incorporate your approach (centralized spec_helper.rb setup + logger silencing) and added a Co-authored-by credit. This PR also covers the Sidekiq::Testing.inline!Sidekiq.testing!(:inline) migration that #999 didn't include.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant