Permalink
Browse files

Add JID for inline testing, fixes #1454

  • Loading branch information...
1 parent 3a6cadc commit b0107b5d99a576d023ec2c8ee398f292cc8c8407 @mperham committed Jan 30, 2014
Showing with 15 additions and 1 deletion.
  1. +8 −0 Changes.md
  2. +6 −1 lib/sidekiq/testing.rb
  3. +1 −0 test/test_testing_inline.rb
View
@@ -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
-----------
View
@@ -1,3 +1,5 @@
+require 'securerandom'
+
module Sidekiq
class Testing
@@ -64,8 +66,11 @@ def raw_push(payloads)
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 ParameterIsNotString < RuntimeError; end
class InlineWorker
include Sidekiq::Worker
def perform(pass)
+ raise ArgumentError, "no jid" unless jid
raise InlineError unless pass
end
end

0 comments on commit b0107b5

Please sign in to comment.