Skip to content

Use updated Sidekiq wrapper class name in test #54991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zzak
Copy link
Member

@zzak zzak commented Apr 29, 2025

This is due to sidekiq/sidekiq@4d80a26 changing the name used when queueing jobs.

/cc @yahonda @seuros

@rails-bot rails-bot bot added the activejob label Apr 29, 2025
@@ -34,8 +34,14 @@ class QueuingTest < ActiveSupport::TestCase
test "should supply a wrapped class name to Sidekiq" do
Sidekiq::Testing.fake! do
::HelloJob.perform_later
hash = ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper.jobs.first
assert_equal "ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper", hash["class"]
if Sidekiq::VERSION >= "8.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition will be always true, since we always test on latest.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 It was late, I was thinking this would be easier to backport, but in any case we don't lock the version of sidekiq afaik so we should just update the name, I guess.

This is due to sidekiq/sidekiq@4d80a26 changing the name used when
queueing jobs.
@zzak zzak changed the title Conditionally choose which AJ wrapper to use for sidekiq test Use updated Sidekiq wrapper class name in test Apr 30, 2025
@zzak zzak mentioned this pull request May 5, 2025
4 tasks
@yahonda
Copy link
Member

yahonda commented Jun 3, 2025

One of the reasons I hesitated to merge this pull request is the note in the Sidekiq changelog stating that “the old name will still work in 8.x.” https://github.com/sidekiq/sidekiq/blob/main/Changes.md?plain=1#L37-L38

Given that, I was expecting the old name ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper to continue working in Sidekiq 8.0.3 and later versions of 8.x.

I also noticed that similar tests already exist on the Sidekiq side—for example. https://github.com/sidekiq/sidekiq/blob/aee9da68706536fcacbaad069794644f027c3278/test/active_job_adapter_test.rb#L47-L68

So I’m wondering whether we need to keep this integration test in Rails, or if it might be redundant.

@zzak
Copy link
Member Author

zzak commented Jun 5, 2025

@yahonda I'm on the fence about removing the test, because for historical purposes (i.e. stable branches) it's value is that:

  • Given an ActiveJob object is enqueued, the class of that job is our JobWrapper

But the actual name is an implementation detail, and not even public API:

So the value of the test is purely internal, iiuc.

Meaning we get to choose if we want to maintain it or not.

If we do, I can see #55148 as an acceptable alternative to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants