diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/services/ci/after_requeue_job_service_spec.rb | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/services/ci/after_requeue_job_service_spec.rb')
-rw-r--r-- | spec/services/ci/after_requeue_job_service_spec.rb | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/spec/services/ci/after_requeue_job_service_spec.rb b/spec/services/ci/after_requeue_job_service_spec.rb index f8c49060ce0..df5ddcafb37 100644 --- a/spec/services/ci/after_requeue_job_service_spec.rb +++ b/spec/services/ci/after_requeue_job_service_spec.rb @@ -8,37 +8,41 @@ RSpec.describe Ci::AfterRequeueJobService do let(:pipeline) { create(:ci_pipeline, project: project) } + let!(:build) { create(:ci_build, pipeline: pipeline, stage_idx: 0, name: 'build') } 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') } + let!(:test3) { create(:ci_build, :skipped, :dependent, pipeline: pipeline, stage_idx: 1, needed: build) } + let!(:deploy) { create(:ci_build, :skipped, :dependent, pipeline: pipeline, stage_idx: 2, needed: test3) } subject(:execute_service) { described_class.new(project, user).execute(build) } it 'marks subsequent skipped jobs as processable' do expect(test1.reload).to be_success expect(test2.reload).to be_skipped + expect(test3.reload).to be_skipped + expect(deploy.reload).to be_skipped execute_service expect(test1.reload).to be_success expect(test2.reload).to be_created + expect(test3.reload).to be_created + expect(deploy.reload).to be_created end context 'when there is a job need from the same stage' do - let!(:test3) do + let!(:test4) do create(:ci_build, :skipped, + :dependent, pipeline: pipeline, stage_idx: 0, - scheduling_type: :dag) - end - - before do - create(:ci_build_need, build: test3, name: 'build') + scheduling_type: :dag, + needed: build) end it 'marks subsequent skipped jobs as processable' do - expect { execute_service }.to change { test3.reload.status }.from('skipped').to('created') + expect { execute_service }.to change { test4.reload.status }.from('skipped').to('created') end context 'with ci_same_stage_job_needs FF disabled' do @@ -47,7 +51,7 @@ RSpec.describe Ci::AfterRequeueJobService do end it 'does nothing with the build' do - expect { execute_service }.not_to change { test3.reload.status } + expect { execute_service }.not_to change { test4.reload.status } end end end |