diff options
Diffstat (limited to 'spec/lib/gitlab/sidekiq_logging/deduplication_logger_spec.rb')
-rw-r--r-- | spec/lib/gitlab/sidekiq_logging/deduplication_logger_spec.rb | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/spec/lib/gitlab/sidekiq_logging/deduplication_logger_spec.rb b/spec/lib/gitlab/sidekiq_logging/deduplication_logger_spec.rb index 82f927fe481..f44a1e8b6ba 100644 --- a/spec/lib/gitlab/sidekiq_logging/deduplication_logger_spec.rb +++ b/spec/lib/gitlab/sidekiq_logging/deduplication_logger_spec.rb @@ -23,11 +23,37 @@ RSpec.describe Gitlab::SidekiqLogging::DeduplicationLogger do } expect(Sidekiq.logger).to receive(:info).with(a_hash_including(expected_payload)).and_call_original - described_class.instance.log(job, "a fancy strategy", { foo: :bar }) + described_class.instance.deduplicated_log(job, "a fancy strategy", { foo: :bar }) end it "does not modify the job" do - expect { described_class.instance.log(job, "a fancy strategy") } + expect { described_class.instance.deduplicated_log(job, "a fancy strategy") } + .not_to change { job } + end + end + + describe '#rescheduled_log' do + let(:job) do + { + 'class' => 'TestWorker', + 'args' => [1234, 'hello', { 'key' => 'value' }], + 'jid' => 'da883554ee4fe414012f5f42', + 'correlation_id' => 'cid' + } + end + + it 'logs a rescheduled message to the sidekiq logger' do + expected_payload = { + 'job_status' => 'rescheduled', + 'message' => "#{job['class']} JID-#{job['jid']}: rescheduled" + } + expect(Sidekiq.logger).to receive(:info).with(a_hash_including(expected_payload)).and_call_original + + described_class.instance.rescheduled_log(job) + end + + it 'does not modify the job' do + expect { described_class.instance.rescheduled_log(job) } .not_to change { job } end end |