File obs-server-2.10-0115-Adapt-the-minitests-to-the-Rails-6-upgrade.patch of Package obs-server

From 73a3162df83642c0b65b73e635b51e806c50e5be Mon Sep 17 00:00:00 2001
From: Lukas Krause <lkrause@suse.de>
Date: Fri, 3 Apr 2020 16:15:41 +0200
Subject: [PATCH] Adapt the minitests to the Rails 6 upgrade

* Fix know issues with the ActiveJob queue_adapter with Rails 6
  for tests cases, in the minitests.
* Adapt outdated syntax in fixtures

Co-authored-by: Eduardo Navarro <enavarro@suse.com>
Co-authored-by: Stephan Kulow <coolo@suse.de>
---
 src/api/test/fixtures/path_elements.yml             | 4 ++--
 src/api/test/functional/channel_maintenance_test.rb | 4 ++++
 src/api/test/functional/product_test.rb             | 3 +++
 src/api/test/functional/request_controller_test.rb  | 3 +++
 src/api/test/functional/source_services_test.rb     | 3 +++
 5 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/api/test/fixtures/path_elements.yml b/src/api/test/fixtures/path_elements.yml
index d6b16dc337..70f6d7a781 100644
--- a/src/api/test/fixtures/path_elements.yml
+++ b/src/api/test/fixtures/path_elements.yml
@@ -27,8 +27,8 @@ record_6:
   repository_id: 82
   position: 1
 UseRemoteInstance_pop_path:
-  parent_id: BaseDistro_repo
-  repository_id: UseRemoteInstance_pop
+  repository: BaseDistro_repo
+  link: UseRemoteInstance_pop
   position: 1
 kde4_repo:
   parent_id: 98
diff --git a/src/api/test/functional/channel_maintenance_test.rb b/src/api/test/functional/channel_maintenance_test.rb
index 9a31c401c8..872f562338 100644
--- a/src/api/test/functional/channel_maintenance_test.rb
+++ b/src/api/test/functional/channel_maintenance_test.rb
@@ -22,6 +22,10 @@ class ChannelMaintenanceTests < ActionDispatch::IntegrationTest
   # And it is doing a following up update, based on released updates
   #
   def test_large_channel_test
+    # FIXME: https://github.com/rails/rails/issues/37270
+    (ActiveJob::Base.descendants << ActiveJob::Base).each(&:disable_test_adapter)
+    ActiveJob::Base.queue_adapter = :inline
+
     login_king
     put '/source/BaseDistro3/pack2/file', params: 'NOOP'
     assert_response :success
diff --git a/src/api/test/functional/product_test.rb b/src/api/test/functional/product_test.rb
index aee864ed96..7066f5fd6e 100644
--- a/src/api/test/functional/product_test.rb
+++ b/src/api/test/functional/product_test.rb
@@ -8,6 +8,9 @@ class ProductTests < ActionDispatch::IntegrationTest
   def setup
     Backend::Test.start(wait_for_scheduler: true)
     reset_auth
+    # FIXME: https://github.com/rails/rails/issues/37270
+    (ActiveJob::Base.descendants << ActiveJob::Base).each(&:disable_test_adapter)
+    ActiveJob::Base.queue_adapter = :inline
   end
 
   def _simple_product_file_calls(prefix)
diff --git a/src/api/test/functional/request_controller_test.rb b/src/api/test/functional/request_controller_test.rb
index ad82c24034..8dbd8cab34 100644
--- a/src/api/test/functional/request_controller_test.rb
+++ b/src/api/test/functional/request_controller_test.rb
@@ -9,6 +9,9 @@ class RequestControllerTest < ActionDispatch::IntegrationTest
   def setup
     Backend::Test.start(wait_for_scheduler: true)
     reset_auth
+    # FIXME: https://github.com/rails/rails/issues/37270
+    (ActiveJob::Base.descendants << ActiveJob::Base).each(&:disable_test_adapter)
+    ActiveJob::Base.queue_adapter = :inline
   end
 
   teardown do
diff --git a/src/api/test/functional/source_services_test.rb b/src/api/test/functional/source_services_test.rb
index 6a48e1e577..80d81b351f 100644
--- a/src/api/test/functional/source_services_test.rb
+++ b/src/api/test/functional/source_services_test.rb
@@ -67,6 +67,9 @@ class SourceServicesTest < ActionDispatch::IntegrationTest
   end
 
   def test_run_source_service
+    # FIXME: https://github.com/rails/rails/issues/37270
+    (ActiveJob::Base.descendants << ActiveJob::Base).each(&:disable_test_adapter)
+    ActiveJob::Base.queue_adapter = :inline
     login_tom
     put '/source/home:tom/service/_meta', params: "<package project='home:tom' name='service'> <title /> <description /> </package>"
     assert_response :success
-- 
2.31.1