mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Add JID for inline testing, fixes #1454
This commit is contained in:
parent
3a6cadce49
commit
b0107b5d99
3 changed files with 15 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
|||
HEAD
|
||||
-----------
|
||||
|
||||
- Fix JID support in inline testing, #1454
|
||||
- Polish worker arguments display in UI, #1453
|
||||
- Marshal arguments fully to avoid worker mutation, #1452
|
||||
|
||||
|
||||
2.17.3
|
||||
-----------
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
require 'securerandom'
|
||||
|
||||
module Sidekiq
|
||||
|
||||
class Testing
|
||||
|
@ -64,8 +66,11 @@ module Sidekiq
|
|||
true
|
||||
elsif Sidekiq::Testing.inline?
|
||||
payloads.each do |item|
|
||||
jid = item['jid'] || SecureRandom.hex(12)
|
||||
marshalled = Sidekiq.load_json(Sidekiq.dump_json(item))
|
||||
marshalled['class'].constantize.new.perform(*marshalled['args'])
|
||||
worker = marshalled['class'].constantize.new
|
||||
worker.jid = jid
|
||||
worker.perform(*marshalled['args'])
|
||||
end
|
||||
true
|
||||
else
|
||||
|
|
|
@ -17,6 +17,7 @@ class TestInline < Sidekiq::Test
|
|||
class InlineWorker
|
||||
include Sidekiq::Worker
|
||||
def perform(pass)
|
||||
raise ArgumentError, "no jid" unless jid
|
||||
raise InlineError unless pass
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue