diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-15 03:11:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-15 03:11:26 +0300 |
commit | 25c9c07a16a8100809542eb209df4902f5ef427c (patch) | |
tree | 516fdd5ba3dfdd3090150d593f366085dd2e8b0f /spec/workers | |
parent | 1875f933cda5273834ad8bfbe1a4c2ce37b98fee (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/build_hooks_worker_spec.rb | 4 | ||||
-rw-r--r-- | spec/workers/ci/build_finished_worker_spec.rb | 21 |
2 files changed, 19 insertions, 6 deletions
diff --git a/spec/workers/build_hooks_worker_spec.rb b/spec/workers/build_hooks_worker_spec.rb index 426eb03638c..80dc36d268f 100644 --- a/spec/workers/build_hooks_worker_spec.rb +++ b/spec/workers/build_hooks_worker_spec.rb @@ -23,8 +23,8 @@ RSpec.describe BuildHooksWorker do end end - describe '.perform_async' do - it 'sends a message to the application logger, before performing', :sidekiq_inline do + describe '.perform_async', :sidekiq_inline do + it 'sends a message to the application logger, before performing' do build = create(:ci_build) expect(Gitlab::AppLogger).to receive(:info).with( diff --git a/spec/workers/ci/build_finished_worker_spec.rb b/spec/workers/ci/build_finished_worker_spec.rb index 201182636e7..5ddaabc3938 100644 --- a/spec/workers/ci/build_finished_worker_spec.rb +++ b/spec/workers/ci/build_finished_worker_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe Ci::BuildFinishedWorker do + include AfterNextHelpers + subject { described_class.new.perform(build.id) } describe '#perform' do @@ -16,17 +18,28 @@ RSpec.describe Ci::BuildFinishedWorker do it 'calculates coverage and calls hooks', :aggregate_failures do expect(build).to receive(:update_coverage).ordered - expect_next_instance_of(Ci::BuildReportResultService) do |build_report_result_service| - expect(build_report_result_service).to receive(:execute).with(build) - end + expect_next(Ci::BuildReportResultService).to receive(:execute).with(build) - expect(BuildHooksWorker).to receive(:perform_async) + expect(build).to receive(:execute_hooks) expect(ChatNotificationWorker).not_to receive(:perform_async) expect(Ci::ArchiveTraceWorker).to receive(:perform_in) subject end + context 'when the execute_build_hooks_inline feature flag is disabled' do + before do + stub_feature_flags(execute_build_hooks_inline: false) + end + + it 'uses the BuildHooksWorker' do + expect(build).not_to receive(:execute_hooks) + expect(BuildHooksWorker).to receive(:perform_async).with(build) + + subject + end + end + context 'when build is failed' do before do build.update!(status: :failed) |