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

track_failed_build_worker_spec.rb « ci « workers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 12d0e64afc5b0a5774c09b824c01b9cdff7412da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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