Merge branch 'osw-adjust-flaky-rails-logger-call' into 'master'
Adjust flaky Rails logger call test See merge request gitlab-org/gitlab-ce!23916
This commit is contained in:
commit
fd86e74327
2 changed files with 7 additions and 2 deletions
|
@ -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
|
||||||
# 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
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue