diff options
Diffstat (limited to 'spec/services/ci/after_requeue_job_service_spec.rb')
-rw-r--r-- | spec/services/ci/after_requeue_job_service_spec.rb | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/spec/services/ci/after_requeue_job_service_spec.rb b/spec/services/ci/after_requeue_job_service_spec.rb index a2147759dba..f8c49060ce0 100644 --- a/spec/services/ci/after_requeue_job_service_spec.rb +++ b/spec/services/ci/after_requeue_job_service_spec.rb @@ -8,9 +8,9 @@ RSpec.describe Ci::AfterRequeueJobService do let(:pipeline) { create(:ci_pipeline, project: project) } - let!(:build) { create(:ci_build, pipeline: pipeline, stage_idx: 0) } let!(:test1) { create(:ci_build, :success, pipeline: pipeline, stage_idx: 1) } let!(:test2) { create(:ci_build, :skipped, pipeline: pipeline, stage_idx: 1) } + let!(:build) { create(:ci_build, pipeline: pipeline, stage_idx: 0, name: 'build') } subject(:execute_service) { described_class.new(project, user).execute(build) } @@ -24,6 +24,34 @@ RSpec.describe Ci::AfterRequeueJobService do expect(test2.reload).to be_created end + context 'when there is a job need from the same stage' do + let!(:test3) do + create(:ci_build, + :skipped, + pipeline: pipeline, + stage_idx: 0, + scheduling_type: :dag) + end + + before do + create(:ci_build_need, build: test3, name: 'build') + end + + it 'marks subsequent skipped jobs as processable' do + expect { execute_service }.to change { test3.reload.status }.from('skipped').to('created') + end + + context 'with ci_same_stage_job_needs FF disabled' do + before do + stub_feature_flags(ci_same_stage_job_needs: false) + end + + it 'does nothing with the build' do + expect { execute_service }.not_to change { test3.reload.status } + end + end + end + context 'when the pipeline is a downstream pipeline and the bridge is depended' do let!(:trigger_job) { create(:ci_bridge, :strategy_depend, status: 'success') } |