Commit fd86e743 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'osw-adjust-flaky-rails-logger-call' into 'master'

Adjust flaky Rails logger call test

See merge request gitlab-org/gitlab-ce!23916
parents ffef28cc cafc543c
...@@ -4,6 +4,10 @@ class StuckMergeJobsWorker ...@@ -4,6 +4,10 @@ class StuckMergeJobsWorker
include ApplicationWorker include ApplicationWorker
include CronjobQueue include CronjobQueue
def self.logger
Rails.logger
end
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def perform def perform
stuck_merge_requests.find_in_batches(batch_size: 100) do |group| stuck_merge_requests.find_in_batches(batch_size: 100) do |group|
...@@ -35,7 +39,7 @@ class StuckMergeJobsWorker ...@@ -35,7 +39,7 @@ class StuckMergeJobsWorker
# We rely on state machine callbacks to update head_pipeline_id # We rely on state machine callbacks to update head_pipeline_id
merge_requests_to_reopen.each(&:unlock_mr) merge_requests_to_reopen.each(&:unlock_mr)
Rails.logger.info("Updated state of locked merge jobs. JIDs: #{completed_jids.join(', ')}") self.class.logger.info("Updated state of locked merge jobs. JIDs: #{completed_jids.join(', ')}")
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
......
...@@ -38,7 +38,8 @@ describe StuckMergeJobsWorker do ...@@ -38,7 +38,8 @@ describe StuckMergeJobsWorker do
create(:merge_request, :locked, merge_jid: '123') create(:merge_request, :locked, merge_jid: '123')
create(:merge_request, :locked, merge_jid: '456') create(:merge_request, :locked, merge_jid: '456')
expect(Rails).to receive_message_chain(:logger, :info).with('Updated state of locked merge jobs. JIDs: 123, 456') expect(described_class).to receive_message_chain(:logger, :info)
.with('Updated state of locked merge jobs. JIDs: 123, 456')
worker.perform worker.perform
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment