diff --git a/Changes.md b/Changes.md index ee16f3c9..b6b377e5 100644 --- a/Changes.md +++ b/Changes.md @@ -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 ----------- diff --git a/lib/sidekiq/testing.rb b/lib/sidekiq/testing.rb index 7fb8b510..ab409592 100644 --- a/lib/sidekiq/testing.rb +++ b/lib/sidekiq/testing.rb @@ -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 diff --git a/test/test_testing_inline.rb b/test/test_testing_inline.rb index 9801a55d..356c5301 100644 --- a/test/test_testing_inline.rb +++ b/test/test_testing_inline.rb @@ -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