diff options
Diffstat (limited to 'spec/services/ci/process_pipeline_service_spec.rb')
-rw-r--r-- | spec/services/ci/process_pipeline_service_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/services/ci/process_pipeline_service_spec.rb b/spec/services/ci/process_pipeline_service_spec.rb index a7889f0644d..d316c9a262b 100644 --- a/spec/services/ci/process_pipeline_service_spec.rb +++ b/spec/services/ci/process_pipeline_service_spec.rb @@ -50,6 +50,35 @@ RSpec.describe Ci::ProcessPipelineService do expect(all_builds.retried).to contain_exactly(build_retried) end + context 'counter ci_legacy_update_jobs_as_retried_total' do + let(:counter) { double(increment: true) } + + before do + allow(Gitlab::Metrics).to receive(:counter).and_call_original + allow(Gitlab::Metrics).to receive(:counter) + .with(:ci_legacy_update_jobs_as_retried_total, anything) + .and_return(counter) + end + + it 'increments the counter' do + expect(counter).to receive(:increment) + + subject.execute + end + + context 'when the previous build has already retried column true' do + before do + build_retried.update_columns(retried: true) + end + + it 'does not increment the counter' do + expect(counter).not_to receive(:increment) + + subject.execute + end + end + end + def create_build(name, **opts) create(:ci_build, :created, pipeline: pipeline, name: name, **opts) end |