From 88e18b7b9826b05e8485a6a99593ecda850969d7 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Tue, 24 Oct 2023 11:42:38 -0400 Subject: [PATCH 1/1] 20846: Update kwargs usage for ruby 3. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- services/api/app/models/container.rb | 2 +- services/api/test/test_helper.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb index ca43fde5a9..ee338b81ff 100644 --- a/services/api/app/models/container.rb +++ b/services/api/app/models/container.rb @@ -319,7 +319,7 @@ class Container < ArvadosModel resolved_runtime_constraints.delete('cuda') ].uniq end - reusable_runtime_constraints = hash_product(runtime_constraint_variations) + reusable_runtime_constraints = hash_product(**runtime_constraint_variations) .map { |v| resolved_runtime_constraints.merge(v) } candidates = candidates.where_serialized(:runtime_constraints, reusable_runtime_constraints, md5: true, multivalue: true) diff --git a/services/api/test/test_helper.rb b/services/api/test/test_helper.rb index 08696a9983..e907367446 100644 --- a/services/api/test/test_helper.rb +++ b/services/api/test/test_helper.rb @@ -179,21 +179,21 @@ class ActionController::TestCase end [:get, :post, :put, :patch, :delete].each do |method| - define_method method do |action, *args| + define_method method do |action, **args| check_counter action # After Rails 5.0 upgrade, some params don't get properly serialized. # One case are filters: [['attr', 'op', 'val']] become [['attr'], ['op'], ['val']] # if not passed upstream as a JSON string. - if args[0].is_a?(Hash) && args[0][:params].is_a?(Hash) - args[0][:params].each do |key, _| + if args[:params].is_a?(Hash) + args[:params].each do |key, _| next if key == :exclude_script_versions # Job Reuse tests # Keys could be: :filters, :where, etc - if [Array, Hash].include?(args[0][:params][key].class) - args[0][:params][key] = SafeJSON.dump(args[0][:params][key]) + if [Array, Hash].include?(args[:params][key].class) + args[:params][key] = SafeJSON.dump(args[:params][key]) end end end - super action, *args + super action, **args end end -- 2.30.2