diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-14 15:09:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-14 15:09:44 +0000 |
commit | 874ead9c3a50de4c4ca4551eaf5b7eb976d26b50 (patch) | |
tree | 637ee9f2da5e251bc08ebf3e972209d51966bf7c /spec/lib/gitlab | |
parent | 2e4c4055181eec9186458dd5dd3219c937032ec7 (diff) | |
download | gitlab-ce-874ead9c3a50de4c4ca4551eaf5b7eb976d26b50.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb | 20 | ||||
-rw-r--r-- | spec/lib/gitlab/sidekiq_middleware/duplicate_jobs_spec.rb | 31 |
2 files changed, 7 insertions, 44 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 e11613b202d..6e8a8c03aad 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 @@ -113,28 +113,22 @@ describe Gitlab::SidekiqMiddleware::DuplicateJobs::DuplicateJob, :clean_gitlab_r end describe 'droppable?' do - where(:idempotent, :duplicate, :feature_enabled) do - # [true, false].repeated_permutation(3) - [[true, true, true], - [true, true, false], - [true, false, true], - [true, false, false], - [false, true, true], - [false, true, false], - [false, false, true], - [false, false, false]] + where(:idempotent, :duplicate) do + # [true, false].repeated_permutation(2) + [[true, true], + [true, false], + [false, true], + [false, false]] end with_them do before do allow(AuthorizedProjectsWorker).to receive(:idempotent?).and_return(idempotent) allow(duplicate_job).to receive(:duplicate?).and_return(duplicate) - allow(Gitlab::SidekiqMiddleware::DuplicateJobs) - .to receive(:drop_duplicates?).with(queue).and_return(feature_enabled) end it 'is droppable when all conditions are met' do - if idempotent && duplicate && feature_enabled + if idempotent && duplicate expect(duplicate_job).to be_droppable else expect(duplicate_job).not_to be_droppable diff --git a/spec/lib/gitlab/sidekiq_middleware/duplicate_jobs_spec.rb b/spec/lib/gitlab/sidekiq_middleware/duplicate_jobs_spec.rb deleted file mode 100644 index fa5938f470b..00000000000 --- a/spec/lib/gitlab/sidekiq_middleware/duplicate_jobs_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe Gitlab::SidekiqMiddleware::DuplicateJobs do - using RSpec::Parameterized::TableSyntax - - describe '.drop_duplicates?' do - where(:global_feature_enabled, :selected_queue_enabled, :queue, :expected) do - true | true | described_class::DROPPABLE_QUEUES.first | true - true | true | "other_queue" | true - true | false | described_class::DROPPABLE_QUEUES.first | true - true | false | "other_queue" | true - false | true | described_class::DROPPABLE_QUEUES.first | true - false | true | "other_queue" | false - false | false | described_class::DROPPABLE_QUEUES.first | false - false | false | "other_queue" | false - end - - with_them do - before do - stub_feature_flags(drop_duplicate_sidekiq_jobs: global_feature_enabled, - drop_duplicate_sidekiq_jobs_for_queue: selected_queue_enabled) - end - - it "allows dropping jobs when expected" do - expect(described_class.drop_duplicates?(queue)).to be(expected) - end - end - end -end |