diff options
Diffstat (limited to 'spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb')
-rw-r--r-- | spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb b/spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb index a46275d90b6..993edcab87d 100644 --- a/spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb +++ b/spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb @@ -241,6 +241,24 @@ RSpec.describe Gitlab::SidekiqMiddleware::DuplicateJobs::DuplicateJob, :clean_gi expect(cookie['offsets']).to eq({ 'c1' => 1, 'c2' => 2, 'c3' => 3 }) end end + + context 'when a WAL location is nil with existing offsets' do + let(:existing_cookie) do + { + 'offsets' => { 'main' => 8, 'ci' => 5 }, + 'wal_locations' => { 'main' => 'loc1old', 'ci' => 'loc2old' } + } + end + + let(:argv) { ['main', 9, 'loc1', 'ci', nil, 'loc2'] } + + it 'only updates the main connection' do + subject + + expect(cookie['wal_locations']).to eq({ 'main' => 'loc1', 'ci' => 'loc2old' }) + expect(cookie['offsets']).to eq({ 'main' => 9, 'ci' => 5 }) + end + end end end |