diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-01 15:12:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-01 15:12:10 +0300 |
commit | 9c5341dd0832c3af377191c461c800e1aa048b10 (patch) | |
tree | e1343570ed06960c320200c8a35f2675a6ec2b48 /spec/workers | |
parent | 46f35a616740504125aaf2c7d20a8bc7ff755ec1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/concerns/waitable_worker_spec.rb | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/spec/workers/concerns/waitable_worker_spec.rb b/spec/workers/concerns/waitable_worker_spec.rb index f6d4cc4679d..bf156c3b8cb 100644 --- a/spec/workers/concerns/waitable_worker_spec.rb +++ b/spec/workers/concerns/waitable_worker_spec.rb @@ -30,19 +30,33 @@ RSpec.describe WaitableWorker do describe '.bulk_perform_and_wait' do context '1 job' do - it 'inlines the job' do - args_list = [[1]] - expect(worker).to receive(:bulk_perform_inline).with(args_list).and_call_original - expect(Gitlab::AppJsonLogger).to( - receive(:info).with(a_hash_including('message' => 'running inline', - 'class' => 'Gitlab::Foo::Bar::DummyWorker', - 'job_status' => 'running', - 'queue' => 'foo_bar_dummy')) - .once) - - worker.bulk_perform_and_wait(args_list) - - expect(worker.counter).to eq(1) + it 'runs the jobs asynchronously' do + arguments = [[1]] + + expect(worker).to receive(:bulk_perform_async).with(arguments) + + worker.bulk_perform_and_wait(arguments) + end + + context 'when the feature flag `always_async_project_authorizations_refresh` is turned off' do + before do + stub_feature_flags(always_async_project_authorizations_refresh: false) + end + + it 'inlines the job' do + args_list = [[1]] + expect(worker).to receive(:bulk_perform_inline).with(args_list).and_call_original + expect(Gitlab::AppJsonLogger).to( + receive(:info).with(a_hash_including('message' => 'running inline', + 'class' => 'Gitlab::Foo::Bar::DummyWorker', + 'job_status' => 'running', + 'queue' => 'foo_bar_dummy')) + .once) + + worker.bulk_perform_and_wait(args_list) + + expect(worker.counter).to eq(1) + end end end |