diff options
Diffstat (limited to 'spec/services/ci/process_build_service_spec.rb')
-rw-r--r-- | spec/services/ci/process_build_service_spec.rb | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/spec/services/ci/process_build_service_spec.rb b/spec/services/ci/process_build_service_spec.rb index a6e8732f5ff..6d2af81a6e8 100644 --- a/spec/services/ci/process_build_service_spec.rb +++ b/spec/services/ci/process_build_service_spec.rb @@ -124,24 +124,46 @@ RSpec.describe Ci::ProcessBuildService, '#execute' do end context 'when build is scheduled with DAG' do + using RSpec::Parameterized::TableSyntax + let(:pipeline) { create(:ci_pipeline, ref: 'master', project: project) } - let!(:build) { create(:ci_build, :created, when: :on_success, pipeline: pipeline, scheduling_type: :dag) } + let!(:build) { create(:ci_build, :created, when: build_when, pipeline: pipeline, scheduling_type: :dag) } let!(:other_build) { create(:ci_build, :created, when: :on_success, pipeline: pipeline) } let!(:build_on_other_build) { create(:ci_build_need, build: build, name: other_build.name) } - context 'when current status is success' do - let(:current_status) { 'success' } + where(:build_when, :current_status, :after_status) do + :on_success | 'success' | 'pending' + :on_success | 'skipped' | 'skipped' + :manual | 'success' | 'manual' + :manual | 'skipped' | 'skipped' + :delayed | 'success' | 'manual' + :delayed | 'skipped' | 'skipped' + end - it 'enqueues the build' do - expect { subject }.to change { build.status }.to('pending') + with_them do + it 'proceeds the build' do + expect { subject }.to change { build.status }.to(after_status) end end - context 'when current status is skipped' do - let(:current_status) { 'skipped' } + context 'when FF skip_dag_manual_and_delayed_jobs is disabled' do + before do + stub_feature_flags(skip_dag_manual_and_delayed_jobs: false) + end - it 'skips the build' do - expect { subject }.to change { build.status }.to('skipped') + where(:build_when, :current_status, :after_status) do + :on_success | 'success' | 'pending' + :on_success | 'skipped' | 'skipped' + :manual | 'success' | 'manual' + :manual | 'skipped' | 'manual' + :delayed | 'success' | 'manual' + :delayed | 'skipped' | 'manual' + end + + with_them do + it 'proceeds the build' do + expect { subject }.to change { build.status }.to(after_status) + end end end end |