From 8d2b1406bc201d8705e931b6f043441930f2e8ac Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Mon, 23 Mar 2015 15:16:07 -0700 Subject: Pass wrapped class name to Sidekiq for logging purposes Sidekiq logs the name of the job class being performed. Because ActiveJob wraps the class, this means every job logs as an AJ::JobWrapper instead of the actual class name. Will help fix mperham/sidekiq#2248 --- activejob/test/integration/queuing_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'activejob/test') diff --git a/activejob/test/integration/queuing_test.rb b/activejob/test/integration/queuing_test.rb index 38874b51a8..af19a92118 100644 --- a/activejob/test/integration/queuing_test.rb +++ b/activejob/test/integration/queuing_test.rb @@ -1,5 +1,6 @@ require 'helper' require 'jobs/logging_job' +require 'jobs/hello_job' require 'active_support/core_ext/numeric/time' class QueuingTest < ActiveSupport::TestCase @@ -23,6 +24,18 @@ class QueuingTest < ActiveSupport::TestCase end end + test 'should supply a wrapped class name to Sidekiq' do + skip unless adapter_is?(:sidekiq) + require 'sidekiq/testing' + + Sidekiq::Testing.fake! do + ::HelloJob.perform_later + hash = ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper.jobs.first + assert_equal "ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper", hash['class'] + assert_equal "HelloJob", hash['wrapped'] + end + end + test 'should not run job enqueued in the future' do begin TestJob.set(wait: 10.minutes).perform_later @id -- cgit v1.2.3