diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 20:02:30 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 20:02:30 +0000 |
commit | 41fe97390ceddf945f3d967b8fdb3de4c66b7dea (patch) | |
tree | 9c8d89a8624828992f06d892cd2f43818ff5dcc8 /spec/lib/gitlab/sidekiq_middleware | |
parent | 0804d2dc31052fb45a1efecedc8e06ce9bc32862 (diff) | |
download | gitlab-ce-41fe97390ceddf945f3d967b8fdb3de4c66b7dea.tar.gz |
Add latest changes from gitlab-org/gitlab@14-9-stable-eev14.9.0-rc42
Diffstat (limited to 'spec/lib/gitlab/sidekiq_middleware')
-rw-r--r-- | spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb | 86 |
1 files changed, 0 insertions, 86 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 833de6ae624..8d46845548a 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 @@ -122,20 +122,6 @@ RSpec.describe Gitlab::SidekiqMiddleware::DuplicateJobs::DuplicateJob, :clean_gi it_behaves_like 'sets Redis keys with correct TTL' end - context 'when preserve_latest_wal_locations_for_idempotent_jobs feature flag is disabled' do - before do - stub_feature_flags(preserve_latest_wal_locations_for_idempotent_jobs: false) - end - - it "does not change the existing wal locations key's TTL" do - expect { duplicate_job.check! } - .to not_change { read_idempotency_key_with_ttl(existing_wal_location_key(idempotency_key, :main)) } - .from([nil, -2]) - .and not_change { read_idempotency_key_with_ttl(existing_wal_location_key(idempotency_key, :ci)) } - .from([nil, -2]) - end - end - it "adds the idempotency key to the jobs payload" do expect { duplicate_job.check! }.to change { job['idempotency_key'] }.from(nil).to(idempotency_key) end @@ -186,28 +172,6 @@ RSpec.describe Gitlab::SidekiqMiddleware::DuplicateJobs::DuplicateJob, :clean_gi duplicate_job.check! end - context 'when preserve_latest_wal_locations_for_idempotent_jobs feature flag is disabled' do - let(:existing_wal) { {} } - - before do - stub_feature_flags(preserve_latest_wal_locations_for_idempotent_jobs: false) - end - - it "doesn't call Sidekiq.redis" do - expect(Sidekiq).not_to receive(:redis) - - duplicate_job.update_latest_wal_location! - end - - it "doesn't update a wal location to redis with an offset" do - expect { duplicate_job.update_latest_wal_location! } - .to not_change { read_range_from_redis(wal_location_key(idempotency_key, :main)) } - .from([]) - .and not_change { read_range_from_redis(wal_location_key(idempotency_key, :ci)) } - .from([]) - end - end - context "when the key doesn't exists in redis" do let(:existing_wal) do { @@ -328,20 +292,6 @@ RSpec.describe Gitlab::SidekiqMiddleware::DuplicateJobs::DuplicateJob, :clean_gi context 'when job is not deduplication and wal locations were not persisted' do it { expect(duplicate_job.latest_wal_locations).to be_empty } end - - context 'when preserve_latest_wal_locations_for_idempotent_jobs feature flag is disabled' do - before do - stub_feature_flags(preserve_latest_wal_locations_for_idempotent_jobs: false) - end - - it "doesn't call Sidekiq.redis" do - expect(Sidekiq).not_to receive(:redis) - - duplicate_job.latest_wal_locations - end - - it { expect(duplicate_job.latest_wal_locations).to eq({}) } - end end describe '#delete!' do @@ -406,32 +356,6 @@ RSpec.describe Gitlab::SidekiqMiddleware::DuplicateJobs::DuplicateJob, :clean_gi let(:key) { wal_location_key(idempotency_key, :ci) } let(:from_value) { wal_locations[:ci] } end - - context 'when preserve_latest_wal_locations_for_idempotent_jobs feature flag is disabled' do - before do - stub_feature_flags(preserve_latest_wal_locations_for_idempotent_jobs: false) - end - - it_behaves_like 'does not delete key from redis', 'latest wal location keys for main database' do - let(:key) { existing_wal_location_key(idempotency_key, :main) } - let(:from_value) { wal_locations[:main] } - end - - it_behaves_like 'does not delete key from redis', 'latest wal location keys for ci database' do - let(:key) { existing_wal_location_key(idempotency_key, :ci) } - let(:from_value) { wal_locations[:ci] } - end - - it_behaves_like 'does not delete key from redis', 'latest wal location keys for main database' do - let(:key) { wal_location_key(idempotency_key, :main) } - let(:from_value) { wal_locations[:main] } - end - - it_behaves_like 'does not delete key from redis', 'latest wal location keys for ci database' do - let(:key) { wal_location_key(idempotency_key, :ci) } - let(:from_value) { wal_locations[:ci] } - end - end end context 'when the idempotency key is not part of the job' do @@ -666,16 +590,6 @@ RSpec.describe Gitlab::SidekiqMiddleware::DuplicateJobs::DuplicateJob, :clean_gi it 'returns true' do expect(duplicate_job).to be_idempotent end - - context 'when preserve_latest_wal_locations_for_idempotent_jobs feature flag is disabled' do - before do - stub_feature_flags(preserve_latest_wal_locations_for_idempotent_jobs: false) - end - - it 'returns false' do - expect(duplicate_job).not_to be_idempotent - end - end end end |