Should iterable jobs respect fake tests and ignore Redis altogether?
#6729
Closed
araishikeiwai
started this conversation in
Ideas
Replies: 2 comments 2 replies
-
|
Sidekiq does not support environments without Redis. Why don't you want to install Redis locally? |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
I'm not going to add any further support for running Sidekiq without Redis in any mode of operation. It's trivial to enable Redis within CI. sidekiq/.github/workflows/ci.yml Lines 38 to 42 in a2594b6 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I find that even with
Sidekiq::Testing.fake!, iterable jobs will still be using redis (https://github.com/sidekiq/sidekiq/blob/main/lib/sidekiq/job/iterable.rb)This is problematic for test environments that don't have Redis running.
I managed to make it work in RSpec with MockRedis
allow(Sidekiq).to receive(:redis).and_yield(MockRedis.new), but this didn't work in Minitest + MochaSidekiq.stubs(:redis).yields(MockRedis.new)because mocha'syieldsdoes not return the block result as its return value, instead it returnsnilin this line which causesNoMethodError: undefined method `empty?' for nil:NilClassI know Mike does not support mocking out Redis but with the way iterable jobs are implemented, it's not possible to run tests on them without having Redis running (which may not be available in everyone's CI setup). Is it possible to prepend the iterable job module with a faked out methods that bypass Redis similar to how
Sidekiq::Client'satomic_pushbehaviour is changed infake?Or maybe the actual implementation itself could be changed not to rely on the block value return? i.e. among other Redis calls in the file:
which I found work with Mocha stubbing above.
Beta Was this translation helpful? Give feedback.
All reactions