Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-17 00:12:07 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-17 00:12:07 +0300
commit2571f434015308eccb425059ad5e82851521265a (patch)
treea323b0a704a287e8e94d25e2480f321d13bab6cc /spec/workers
parent8a9790b0db723db32f8dff511ee032e5e8e3b583 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/ci/track_failed_build_worker_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/workers/ci/track_failed_build_worker_spec.rb b/spec/workers/ci/track_failed_build_worker_spec.rb
new file mode 100644
index 00000000000..12d0e64afc5
--- /dev/null
+++ b/spec/workers/ci/track_failed_build_worker_spec.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe ::Ci::TrackFailedBuildWorker do
+ let_it_be(:build) { create(:ci_build, :failed, :sast_report) }
+ let_it_be(:exit_code) { 42 }
+ let_it_be(:failure_reason) { "script_failure" }
+
+ subject { described_class.new.perform(build.id, exit_code, failure_reason) }
+
+ describe '#perform' do
+ context 'when a build has failed' do
+ it 'executes track service' do
+ expect(Ci::TrackFailedBuildService)
+ .to receive(:new)
+ .with(build: build, exit_code: exit_code, failure_reason: failure_reason)
+ .and_call_original
+
+ subject
+ end
+ end
+
+ it_behaves_like 'an idempotent worker' do
+ let(:job_args) { [build.id, exit_code, failure_reason] }
+ end
+ end
+end