summaryrefslogtreecommitdiff
path: root/spec/workers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-20 18:09:31 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-20 18:09:31 +0000
commitae4ef81757bdd2c984777d8f0b2c275bbcb4b17d (patch)
tree1ac23c80190bafb47a1f5a6f1aae9da91d35d9dc /spec/workers
parent194b499aa8e26df26ff70a1e1ce0396587bd5243 (diff)
downloadgitlab-ce-ae4ef81757bdd2c984777d8f0b2c275bbcb4b17d.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/concerns/waitable_worker_spec.rb26
1 files changed, 25 insertions, 1 deletions
diff --git a/spec/workers/concerns/waitable_worker_spec.rb b/spec/workers/concerns/waitable_worker_spec.rb
index 37fadd6ac02..1d76480ccb0 100644
--- a/spec/workers/concerns/waitable_worker_spec.rb
+++ b/spec/workers/concerns/waitable_worker_spec.rb
@@ -44,11 +44,35 @@ describe WaitableWorker do
expect(worker.counter).to eq(6)
end
- it 'runs > 3 jobs using sidekiq' do
+ it 'runs > 3 jobs using sidekiq and a waiter key' do
expect(worker).to receive(:bulk_perform_async)
+ .with([[1, anything], [2, anything], [3, anything], [4, anything]])
worker.bulk_perform_and_wait([[1], [2], [3], [4]])
end
+
+ it 'runs > 10 * timeout jobs using sidekiq and no waiter key' do
+ arguments = 1.upto(21).map { |i| [i] }
+
+ expect(worker).to receive(:bulk_perform_async).with(arguments)
+
+ worker.bulk_perform_and_wait(arguments, timeout: 2)
+ end
+
+ context 'when the skip_job_waiter_for_large_batches flag is disabled' do
+ before do
+ stub_feature_flags(skip_job_waiter_for_large_batches: false)
+ end
+
+ it 'runs jobs over 10 * the timeout using a waiter key' do
+ arguments = 1.upto(21).map { |i| [i] }
+ arguments_with_waiter = arguments.map { |arg| arg + [anything] }
+
+ expect(worker).to receive(:bulk_perform_async).with(arguments_with_waiter)
+
+ worker.bulk_perform_and_wait(arguments, timeout: 2)
+ end
+ end
end
describe '.bulk_perform_inline' do