diff options
Diffstat (limited to 'spec/services/ci/pipeline_processing')
27 files changed, 435 insertions, 55 deletions
diff --git a/spec/services/ci/pipeline_processing/atomic_processing_service_spec.rb b/spec/services/ci/pipeline_processing/atomic_processing_service_spec.rb index a10a333b462..bc8b6b2d113 100644 --- a/spec/services/ci/pipeline_processing/atomic_processing_service_spec.rb +++ b/spec/services/ci/pipeline_processing/atomic_processing_service_spec.rb @@ -5,20 +5,12 @@ require_relative 'shared_processing_service.rb' require_relative 'shared_processing_service_tests_with_yaml.rb' RSpec.describe Ci::PipelineProcessing::AtomicProcessingService do - before do - stub_feature_flags(ci_atomic_processing: true) - - # This feature flag is implicit - # Atomic Processing does not process statuses differently - stub_feature_flags(ci_composite_status: true) - end - it_behaves_like 'Pipeline Processing Service' it_behaves_like 'Pipeline Processing Service Tests With Yaml' private - def process_pipeline(initial_process: false) + def process_pipeline described_class.new(pipeline).execute end end diff --git a/spec/services/ci/pipeline_processing/legacy_processing_service_spec.rb b/spec/services/ci/pipeline_processing/legacy_processing_service_spec.rb deleted file mode 100644 index 569a6d62dc1..00000000000 --- a/spec/services/ci/pipeline_processing/legacy_processing_service_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' -require_relative 'shared_processing_service.rb' -require_relative 'shared_processing_service_tests_with_yaml.rb' - -RSpec.describe Ci::PipelineProcessing::LegacyProcessingService do - before do - stub_feature_flags(ci_atomic_processing: false) - end - - context 'when ci_composite_status is enabled' do - before do - stub_feature_flags(ci_composite_status: true) - end - - it_behaves_like 'Pipeline Processing Service' - it_behaves_like 'Pipeline Processing Service Tests With Yaml' - end - - context 'when ci_composite_status is disabled' do - before do - stub_feature_flags(ci_composite_status: false) - end - - it_behaves_like 'Pipeline Processing Service' - it_behaves_like 'Pipeline Processing Service Tests With Yaml' - end - - private - - def process_pipeline(initial_process: false) - described_class.new(pipeline).execute(initial_process: initial_process) - end -end diff --git a/spec/services/ci/pipeline_processing/shared_processing_service.rb b/spec/services/ci/pipeline_processing/shared_processing_service.rb index 224066885b6..7de22b6a4cc 100644 --- a/spec/services/ci/pipeline_processing/shared_processing_service.rb +++ b/spec/services/ci/pipeline_processing/shared_processing_service.rb @@ -788,8 +788,7 @@ RSpec.shared_examples 'Pipeline Processing Service' do let!(:deploy_pages) { create_build('deploy_pages', stage: 'deploy', stage_idx: 2, scheduling_type: :dag) } it 'runs deploy_pages without waiting prior stages' do - # Ci::PipelineProcessing::LegacyProcessingService requires :initial_process parameter - expect(process_pipeline(initial_process: true)).to be_truthy + expect(process_pipeline).to be_truthy expect(stages).to eq(%w(pending created pending)) expect(builds.pending).to contain_exactly(linux_build, mac_build, deploy_pages) diff --git a/spec/services/ci/pipeline_processing/shared_processing_service_tests_with_yaml.rb b/spec/services/ci/pipeline_processing/shared_processing_service_tests_with_yaml.rb index 17d254ba48e..77645298bc7 100644 --- a/spec/services/ci/pipeline_processing/shared_processing_service_tests_with_yaml.rb +++ b/spec/services/ci/pipeline_processing/shared_processing_service_tests_with_yaml.rb @@ -42,7 +42,7 @@ RSpec.shared_context 'Pipeline Processing Service Tests With Yaml' do { pipeline: pipeline.status, - stages: pipeline.ordered_stages.pluck(:name, :status).to_h, + stages: pipeline.stages.pluck(:name, :status).to_h, jobs: pipeline.statuses.latest.pluck(:name, :status).to_h } end diff --git a/spec/services/ci/pipeline_processing/test_cases/dag_build_fails_other_build_succeeds.yml b/spec/services/ci/pipeline_processing/test_cases/dag_build_fails_other_build_succeeds_deploy_needs_one_build_and_test.yml index a133023b12d..a133023b12d 100644 --- a/spec/services/ci/pipeline_processing/test_cases/dag_build_fails_other_build_succeeds.yml +++ b/spec/services/ci/pipeline_processing/test_cases/dag_build_fails_other_build_succeeds_deploy_needs_one_build_and_test.yml diff --git a/spec/services/ci/pipeline_processing/test_cases/dag_build_fails_other_build_succeeds_deploy_always.yml b/spec/services/ci/pipeline_processing/test_cases/dag_build_fails_other_build_succeeds_deploy_needs_one_build_and_test_when_always.yml index 4c676761e5c..4c676761e5c 100644 --- a/spec/services/ci/pipeline_processing/test_cases/dag_build_fails_other_build_succeeds_deploy_always.yml +++ b/spec/services/ci/pipeline_processing/test_cases/dag_build_fails_other_build_succeeds_deploy_needs_one_build_and_test_when_always.yml diff --git a/spec/services/ci/pipeline_processing/test_cases/dag_build_fails_test_allow_failure.yml b/spec/services/ci/pipeline_processing/test_cases/dag_build_fails_test_fails_with_allow_failure.yml index ea7046262c3..ea7046262c3 100644 --- a/spec/services/ci/pipeline_processing/test_cases/dag_build_fails_test_allow_failure.yml +++ b/spec/services/ci/pipeline_processing/test_cases/dag_build_fails_test_fails_with_allow_failure.yml diff --git a/spec/services/ci/pipeline_processing/test_cases/dag_test_on_failure_with_failure.yml b/spec/services/ci/pipeline_processing/test_cases/dag_build_fails_test_on_failure_deploy_needs_test.yml index 5ace621e89c..5ace621e89c 100644 --- a/spec/services/ci/pipeline_processing/test_cases/dag_test_on_failure_with_failure.yml +++ b/spec/services/ci/pipeline_processing/test_cases/dag_build_fails_test_on_failure_deploy_needs_test.yml diff --git a/spec/services/ci/pipeline_processing/test_cases/dag_build_allow_failure_test_on_failure.yml b/spec/services/ci/pipeline_processing/test_cases/dag_build_fails_with_allow_failure_test_on_failure.yml index cfc456387ff..cfc456387ff 100644 --- a/spec/services/ci/pipeline_processing/test_cases/dag_build_allow_failure_test_on_failure.yml +++ b/spec/services/ci/pipeline_processing/test_cases/dag_build_fails_with_allow_failure_test_on_failure.yml diff --git a/spec/services/ci/pipeline_processing/test_cases/dag_build_succeds_test_manual_allow_failure_true_deploy_needs_both.yml b/spec/services/ci/pipeline_processing/test_cases/dag_build_succeds_test_manual_allow_failure_true_deploy_needs_both.yml new file mode 100644 index 00000000000..60f803bc3d0 --- /dev/null +++ b/spec/services/ci/pipeline_processing/test_cases/dag_build_succeds_test_manual_allow_failure_true_deploy_needs_both.yml @@ -0,0 +1,41 @@ +config: + build: + stage: build + script: exit 0 + + test: + stage: test + when: manual + allow_failure: true + script: exit 1 + + deploy: + stage: deploy + script: exit 0 + needs: [build, test] + +init: + expect: + pipeline: pending + stages: + build: pending + test: created + deploy: created + jobs: + build: pending + test: created + deploy: created + +transitions: + - event: success + jobs: [build] + expect: + pipeline: running + stages: + build: success + test: skipped + deploy: created + jobs: + build: success + test: manual + deploy: created diff --git a/spec/services/ci/pipeline_processing/test_cases/dag_build_succeds_test_manual_allow_failure_true_deploy_needs_test.yml b/spec/services/ci/pipeline_processing/test_cases/dag_build_succeds_test_manual_allow_failure_true_deploy_needs_test.yml new file mode 100644 index 00000000000..4e4b2f22224 --- /dev/null +++ b/spec/services/ci/pipeline_processing/test_cases/dag_build_succeds_test_manual_allow_failure_true_deploy_needs_test.yml @@ -0,0 +1,41 @@ +config: + build: + stage: build + script: exit 0 + + test: + stage: test + when: manual + allow_failure: true + script: exit 0 + + deploy: + stage: deploy + script: exit 0 + needs: [test] + +init: + expect: + pipeline: pending + stages: + build: pending + test: created + deploy: created + jobs: + build: pending + test: created + deploy: created + +transitions: + - event: success + jobs: [build] + expect: + pipeline: running + stages: + build: success + test: skipped + deploy: created + jobs: + build: success + test: manual + deploy: created diff --git a/spec/services/ci/pipeline_processing/test_cases/dag_test_on_failure_with_success.yml b/spec/services/ci/pipeline_processing/test_cases/dag_build_succeeds_test_on_failure_deploy_needs_test.yml index 19524cfd3e4..19524cfd3e4 100644 --- a/spec/services/ci/pipeline_processing/test_cases/dag_test_on_failure_with_success.yml +++ b/spec/services/ci/pipeline_processing/test_cases/dag_build_succeeds_test_on_failure_deploy_needs_test.yml diff --git a/spec/services/ci/pipeline_processing/test_cases/dag_build_test_manual_review_deploy.yml b/spec/services/ci/pipeline_processing/test_cases/dag_build_test_manual_review_deploy.yml new file mode 100644 index 00000000000..fef28dcfbbe --- /dev/null +++ b/spec/services/ci/pipeline_processing/test_cases/dag_build_test_manual_review_deploy.yml @@ -0,0 +1,82 @@ +config: + stages: [build, test, review, deploy] + + build: + stage: build + script: exit 0 + + test: + stage: test + script: exit 0 + + release_test: + stage: test + when: manual + allow_failure: true + script: exit 0 + + review: + stage: review + script: exit 0 + needs: [test, release_test] + + staging: + stage: deploy + script: exit 0 + needs: [test, release_test] + + production: + stage: deploy + script: exit 0 + needs: [review] + +init: + expect: + pipeline: pending + stages: + build: pending + test: created + review: created + deploy: created + jobs: + build: pending + test: created + release_test: created + review: created + staging: created + production: created + +transitions: + - event: success + jobs: [build] + expect: + pipeline: running + stages: + build: success + test: pending + review: created + deploy: created + jobs: + build: success + test: pending + release_test: manual + review: created + staging: created + production: created + + - event: success + jobs: [test] + expect: + pipeline: running + stages: + build: success + test: success + review: created + deploy: created + jobs: + build: success + test: success + release_test: manual + review: created + staging: created + production: created diff --git a/spec/services/ci/pipeline_processing/test_cases/dag_builds_succeed_test_on_failure.yml b/spec/services/ci/pipeline_processing/test_cases/dag_builds_succeed_test_on_failure_deploy_needs_one_build_and_test.yml index f324525bd56..f324525bd56 100644 --- a/spec/services/ci/pipeline_processing/test_cases/dag_builds_succeed_test_on_failure.yml +++ b/spec/services/ci/pipeline_processing/test_cases/dag_builds_succeed_test_on_failure_deploy_needs_one_build_and_test.yml diff --git a/spec/services/ci/pipeline_processing/test_cases/dag_builds_succeed_test_on_failure_deploy_always.yml b/spec/services/ci/pipeline_processing/test_cases/dag_builds_succeed_test_on_failure_deploy_needs_one_build_and_test_when_always.yml index 9986dbaa215..9986dbaa215 100644 --- a/spec/services/ci/pipeline_processing/test_cases/dag_builds_succeed_test_on_failure_deploy_always.yml +++ b/spec/services/ci/pipeline_processing/test_cases/dag_builds_succeed_test_on_failure_deploy_needs_one_build_and_test_when_always.yml diff --git a/spec/services/ci/pipeline_processing/test_cases/dag_deploy_needs_empty.yml b/spec/services/ci/pipeline_processing/test_cases/dag_deploy_needs_empty.yml new file mode 100644 index 00000000000..1783c0acb11 --- /dev/null +++ b/spec/services/ci/pipeline_processing/test_cases/dag_deploy_needs_empty.yml @@ -0,0 +1,27 @@ +config: + build: + stage: build + script: exit 0 + + test: + stage: test + script: exit 0 + + deploy: + stage: deploy + script: exit 0 + needs: [] + +init: + expect: + pipeline: pending + stages: + build: pending + test: created + deploy: pending + jobs: + build: pending + test: created + deploy: pending + +transitions: [] diff --git a/spec/services/ci/pipeline_processing/test_cases/dag_test_allow_failure_true.yml b/spec/services/ci/pipeline_processing/test_cases/dag_test_fails_with_allow_failure.yml index 8d4d9d403f1..8d4d9d403f1 100644 --- a/spec/services/ci/pipeline_processing/test_cases/dag_test_allow_failure_true.yml +++ b/spec/services/ci/pipeline_processing/test_cases/dag_test_fails_with_allow_failure.yml diff --git a/spec/services/ci/pipeline_processing/test_cases/dag_test_manual_allow_failure_false_deploy_always.yml b/spec/services/ci/pipeline_processing/test_cases/dag_test_manual_allow_failure_false_deploy_always.yml new file mode 100644 index 00000000000..bb8723aa303 --- /dev/null +++ b/spec/services/ci/pipeline_processing/test_cases/dag_test_manual_allow_failure_false_deploy_always.yml @@ -0,0 +1,45 @@ +config: + test: + stage: test + when: manual + allow_failure: false + script: exit 1 + + deploy: + stage: deploy + when: always + script: exit 0 + needs: [test] + +init: + expect: + pipeline: manual + stages: + test: manual + deploy: created + jobs: + test: manual + deploy: created + +transitions: + - event: enqueue + jobs: [test] + expect: + pipeline: pending + stages: + test: pending + deploy: created + jobs: + test: pending + deploy: created + + - event: drop + jobs: [test] + expect: + pipeline: running + stages: + test: failed + deploy: pending + jobs: + test: failed + deploy: pending diff --git a/spec/services/ci/pipeline_processing/test_cases/dag_test_manual_allow_failure_false_deploy_on_failure.yml b/spec/services/ci/pipeline_processing/test_cases/dag_test_manual_allow_failure_false_deploy_on_failure.yml new file mode 100644 index 00000000000..3099a94befb --- /dev/null +++ b/spec/services/ci/pipeline_processing/test_cases/dag_test_manual_allow_failure_false_deploy_on_failure.yml @@ -0,0 +1,45 @@ +config: + test: + stage: test + when: manual + allow_failure: false + script: exit 1 + + deploy: + stage: deploy + when: on_failure + script: exit 0 + needs: [test] + +init: + expect: + pipeline: manual + stages: + test: manual + deploy: created + jobs: + test: manual + deploy: created + +transitions: + - event: enqueue + jobs: [test] + expect: + pipeline: pending + stages: + test: pending + deploy: created + jobs: + test: pending + deploy: created + + - event: drop + jobs: [test] + expect: + pipeline: running + stages: + test: failed + deploy: pending + jobs: + test: failed + deploy: pending diff --git a/spec/services/ci/pipeline_processing/test_cases/dag_test_manual_allow_failure_false_other_test_succeeds_deploy_needs_both.yml b/spec/services/ci/pipeline_processing/test_cases/dag_test_manual_allow_failure_false_other_test_succeeds_deploy_needs_both.yml new file mode 100644 index 00000000000..7330a73b5a3 --- /dev/null +++ b/spec/services/ci/pipeline_processing/test_cases/dag_test_manual_allow_failure_false_other_test_succeeds_deploy_needs_both.yml @@ -0,0 +1,40 @@ +config: + test1: + stage: test + script: exit 0 + + test2: + stage: test + when: manual + allow_failure: false + script: exit 1 + + deploy: + stage: deploy + script: exit 0 + needs: [test1, test2] + +init: + expect: + pipeline: running + stages: + test: running + deploy: created + jobs: + test1: pending + test2: manual + deploy: created + +transitions: + - event: success + jobs: [test1] + expect: + pipeline: manual + stages: + test: manual + deploy: created + jobs: + test1: success + test2: manual + deploy: created + diff --git a/spec/services/ci/pipeline_processing/test_cases/dag_test_manual_allow_failure_true_other_test_succeeds.yml b/spec/services/ci/pipeline_processing/test_cases/dag_test_manual_allow_failure_true_other_test_succeeds_deploy_needs_both.yml index 34073b92ccc..34073b92ccc 100644 --- a/spec/services/ci/pipeline_processing/test_cases/dag_test_manual_allow_failure_true_other_test_succeeds.yml +++ b/spec/services/ci/pipeline_processing/test_cases/dag_test_manual_allow_failure_true_other_test_succeeds_deploy_needs_both.yml diff --git a/spec/services/ci/pipeline_processing/test_cases/stage_test_on_failure_with_failure.yml b/spec/services/ci/pipeline_processing/test_cases/stage_build_fails_test_on_failure.yml index 1751cbb2023..1751cbb2023 100644 --- a/spec/services/ci/pipeline_processing/test_cases/stage_test_on_failure_with_failure.yml +++ b/spec/services/ci/pipeline_processing/test_cases/stage_build_fails_test_on_failure.yml diff --git a/spec/services/ci/pipeline_processing/test_cases/stage_build_allow_failure_test_on_failure.yml b/spec/services/ci/pipeline_processing/test_cases/stage_build_fails_with_allow_failure_test_on_failure.yml index 3e081d4411b..3e081d4411b 100644 --- a/spec/services/ci/pipeline_processing/test_cases/stage_build_allow_failure_test_on_failure.yml +++ b/spec/services/ci/pipeline_processing/test_cases/stage_build_fails_with_allow_failure_test_on_failure.yml diff --git a/spec/services/ci/pipeline_processing/test_cases/stage_build_fails_test_allow_failure.yml b/spec/services/ci/pipeline_processing/test_cases/stage_build_succeeds_test_manual_allow_failure_true.yml index 362ac6e4239..2fd85b74d4d 100644 --- a/spec/services/ci/pipeline_processing/test_cases/stage_build_fails_test_allow_failure.yml +++ b/spec/services/ci/pipeline_processing/test_cases/stage_build_succeeds_test_manual_allow_failure_true.yml @@ -1,10 +1,11 @@ config: build: stage: build - script: exit 1 + script: exit 0 test: stage: test + when: manual allow_failure: true script: exit 1 @@ -25,15 +26,15 @@ init: deploy: created transitions: - - event: drop + - event: success jobs: [build] expect: - pipeline: failed + pipeline: running stages: - build: failed + build: success test: skipped - deploy: skipped + deploy: pending jobs: - build: failed - test: skipped - deploy: skipped + build: success + test: manual + deploy: pending diff --git a/spec/services/ci/pipeline_processing/test_cases/stage_test_on_failure_with_success.yml b/spec/services/ci/pipeline_processing/test_cases/stage_build_succeeds_test_on_failure.yml index 15afe1ce8e1..15afe1ce8e1 100644 --- a/spec/services/ci/pipeline_processing/test_cases/stage_test_on_failure_with_success.yml +++ b/spec/services/ci/pipeline_processing/test_cases/stage_build_succeeds_test_on_failure.yml diff --git a/spec/services/ci/pipeline_processing/test_cases/stage_build_test_manual_review_deploy.yml b/spec/services/ci/pipeline_processing/test_cases/stage_build_test_manual_review_deploy.yml new file mode 100644 index 00000000000..2829765fd95 --- /dev/null +++ b/spec/services/ci/pipeline_processing/test_cases/stage_build_test_manual_review_deploy.yml @@ -0,0 +1,79 @@ +config: + stages: [build, test, review, deploy] + + build: + stage: build + script: exit 0 + + test: + stage: test + script: exit 0 + + release_test: + stage: test + when: manual + allow_failure: true + script: exit 0 + + review: + stage: review + script: exit 0 + + staging: + stage: deploy + script: exit 0 + + production: + stage: deploy + script: exit 0 + +init: + expect: + pipeline: pending + stages: + build: pending + test: created + review: created + deploy: created + jobs: + build: pending + test: created + release_test: created + review: created + staging: created + production: created + +transitions: + - event: success + jobs: [build] + expect: + pipeline: running + stages: + build: success + test: pending + review: created + deploy: created + jobs: + build: success + test: pending + release_test: manual + review: created + staging: created + production: created + + - event: success + jobs: [test] + expect: + pipeline: running + stages: + build: success + test: success + review: pending + deploy: created + jobs: + build: success + test: success + release_test: manual + review: pending + staging: created + production: created diff --git a/spec/services/ci/pipeline_processing/test_cases/stage_test_manual_allow_failure_true_deploy_always.yml b/spec/services/ci/pipeline_processing/test_cases/stage_test_manual_allow_failure_true_deploy_always.yml new file mode 100644 index 00000000000..9181c8adf50 --- /dev/null +++ b/spec/services/ci/pipeline_processing/test_cases/stage_test_manual_allow_failure_true_deploy_always.yml @@ -0,0 +1,23 @@ +config: + test: + stage: test + when: manual + allow_failure: true + script: exit 1 + + deploy: + stage: deploy + when: always + script: exit 0 + +init: + expect: + pipeline: pending + stages: + test: skipped + deploy: pending + jobs: + test: manual + deploy: pending + +transitions: [] |