-
Notifications
You must be signed in to change notification settings - Fork 33
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
Integration testing problems #26
Comments
Running into the same kind of issue now. Did you find a solution that works for you? |
This is not particularly elegant, but you can override the Superworker in your own project like this (put this in spec_helper or some required file from there): module Sidekiq
module Superworker
class SuperjobProcessor
def self.create(superjob_id, superworker_class_name, args, subjobs, options={})
if Sidekiq::Testing.inline?
subjobs.each do |subjob|
SubjobProcessor.enqueue(subjob)
end
else
super
end
end
end
end
end |
With batched workers this worked for me by monkey_patching it in spec_helper like @skwp proposed: require 'sidekiq-superworker'
module Sidekiq
module Superworker
class SuperjobProcessor
def self.create(superjob_id, superworker_class_name, args, subjobs, options={})
if Sidekiq::Testing.inline?
subjobs.each do |subjob|
SubjobProcessor.enqueue(subjob) unless subjob.subworker_class == 'batch_child'
end
else
super
end
end
end
end
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Question: I have set Sidekiq::Testing.inline! under spec_helper for my integration tests, is there anything similar on superworkers? I need to run workers and wait for they to finish in order to perform some asserts, how can this be achieved?
The text was updated successfully, but these errors were encountered: