diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-05 09:24:57 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-06 10:04:04 +0100 |
commit | e4554925011eef2be49fd10bd10cde2139342780 (patch) | |
tree | 08a7f7eafca5494225ad9cbc917a6fd44eb4d3cf /spec/services/ci/process_pipeline_service_spec.rb | |
parent | 57253f04c931fa15c3b6aaacd51e971f78425ccb (diff) | |
download | gitlab-ce-e4554925011eef2be49fd10bd10cde2139342780.tar.gz |
Extend specs for pipelines with manual blocking actions
Diffstat (limited to 'spec/services/ci/process_pipeline_service_spec.rb')
-rw-r--r-- | spec/services/ci/process_pipeline_service_spec.rb | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/spec/services/ci/process_pipeline_service_spec.rb b/spec/services/ci/process_pipeline_service_spec.rb index 30b173642e7..c1693aae31b 100644 --- a/spec/services/ci/process_pipeline_service_spec.rb +++ b/spec/services/ci/process_pipeline_service_spec.rb @@ -312,6 +312,61 @@ describe Ci::ProcessPipelineService, '#execute', :services do expect(pipeline.reload).to be_failed end end + + context 'when pipeline is promoted sequentially up to the end' do + it 'properly processes entire pipeline' do + process_pipeline + + expect(builds_names).to eq %w[code:test] + expect(builds_statuses).to eq %w[pending] + + succeed_running_or_pending + + expect(builds_names).to eq %w[code:test staging:deploy] + expect(builds_statuses).to eq %w[success manual] + expect(pipeline.reload).to be_manual + + play_manual_action('staging:deploy') + + expect(builds_statuses).to eq %w[success pending] + + succeed_running_or_pending + + expect(builds_names).to eq %w[code:test staging:deploy staging:test] + expect(builds_statuses).to eq %w[success success pending] + + succeed_running_or_pending + + expect(builds_names).to eq %w[code:test staging:deploy staging:test + production:deploy] + expect(builds_statuses).to eq %w[success success success manual] + + expect(pipeline.reload).to be_manual + # TODO, expect(pipeline.reload).to be_started + expect(pipeline.reload).to be_blocked + expect(pipeline.reload).not_to be_active + expect(pipeline.reload).not_to be_complete + + play_manual_action('production:deploy') + + expect(builds_statuses).to eq %w[success success success pending] + expect(pipeline.reload).to be_running + + succeed_running_or_pending + + expect(builds_names).to eq %w[code:test staging:deploy staging:test + production:deploy production:test] + expect(builds_statuses).to eq %w[success success success success pending] + expect(pipeline.reload).to be_running + + succeed_running_or_pending + + expect(builds_names).to eq %w[code:test staging:deploy staging:test + production:deploy production:test] + expect(builds_statuses).to eq %w[success success success success success] + expect(pipeline.reload).to be_success + end + end end context 'when second stage has only on_failure jobs' do @@ -463,6 +518,10 @@ describe Ci::ProcessPipelineService, '#execute', :services do pipeline.builds.running_or_pending.each(&:cancel) end + def play_manual_action(name) + builds.find_by(name: name).play(user) + end + delegate :manual_actions, to: :pipeline def create_build(name, **opts) |