Skip to content
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

No Sidekiq::Testing.inline! #23

Closed
Bhacaz opened this issue Sep 16, 2022 · 0 comments · Fixed by #24
Closed

No Sidekiq::Testing.inline! #23

Bhacaz opened this issue Sep 16, 2022 · 0 comments · Fixed by #24
Labels

Comments

@Bhacaz
Copy link
Collaborator

Bhacaz commented Sep 16, 2022

Detect offense on Sidekiq::Testing.inline! in spec and suggest to use spy/stub to manually perform specific worker that need to be run.

expect(::HospitalBooking::DeliveryWorker).to receive(:perform_at).exactly(3) do |_time, delivery_id|
  ::HospitalBooking::DeliveryWorker.new.perform delivery_id
end

Using Sidekiq::Testing.inline! can trigger many workers that are not necessary for a specific spec, like model callback using FactoryBot.create, ...

The nightmare scenario is this: user puts Sidekiq jobs into ActiveRecord callbacks, then uses something like factory_girl and creates hundreds of records and thus sidekiq jobs on every test. There is no feedback that tons of Sidekiq jobs are being executed besides the tests being slow. Now the user's unit tests take minutes to complete.
sidekiq/sidekiq#3495

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant