Skip to content

Backport kwargs fix from Ruby 3 branch [RUN ALL RSPEC]

Aleksei Lipniagov requested to merge alipniagov-backport-ruby3-fix into master

What does this MR do and why?

Make the way we pass arguments into Gitlab::SidekiqMiddleware.server_configurator compatible both for Ruby 2.7 and Ruby 3.

The original code would fail on Ruby 3 because of: https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
We explicitly expect keyword args in the constructor - https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/sidekiq_middleware.rb#L10 - in Ruby 2 the hash could be interpreted as kwargs, while Ruby 3 is strict on the syntax.

After this change, the code should be compatible with both Rubies.

Extracted from: !50640 (closed)
It will reduce the Ruby 3 MR diff.

How to set up and validate locally

No particular way to test it.
Good spec to demo the issue is bin/spring rspec spec/lib/gitlab/sidekiq_middleware_spec.rb.
Start the app and check that it works.
Rely on CI, QA.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Aleksei Lipniagov

Merge request reports