diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-06 15:40:50 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-06 15:40:50 +0300 |
commit | 80c463d9c1594c327e60829171e46c9d08b2f5ea (patch) | |
tree | 799deea52f21d7e906376f4deadd402ca56c999f /spec/services | |
parent | b782358f8d08e727e47e2b8a0226b7a4d8b06f0d (diff) |
Extend pipeline retry specs with blocking actions
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/ci/retry_pipeline_service_spec.rb | 61 |
1 files changed, 50 insertions, 11 deletions
diff --git a/spec/services/ci/retry_pipeline_service_spec.rb b/spec/services/ci/retry_pipeline_service_spec.rb index ed2f07c4a7c..5445b65f4e8 100644 --- a/spec/services/ci/retry_pipeline_service_spec.rb +++ b/spec/services/ci/retry_pipeline_service_spec.rb @@ -89,20 +89,59 @@ describe Ci::RetryPipelineService, '#execute', :services do end context 'when pipeline contains manual actions' do - context 'when there is a canceled manual action in first stage' do - before do - create_build('rspec 1', :failed, 0) - create_build('staging', :canceled, 0, when: :manual, allow_failure: true) - create_build('rspec 2', :canceled, 1) + context 'when there are optional manual actions only' do + context 'when there is a canceled manual action in first stage' do + before do + create_build('rspec 1', :failed, 0) + create_build('staging', :canceled, 0, when: :manual, allow_failure: true) + create_build('rspec 2', :canceled, 1) + end + + it 'retries failed builds and marks subsequent for processing' do + service.execute(pipeline) + + expect(build('rspec 1')).to be_pending + expect(build('staging')).to be_manual + expect(build('rspec 2')).to be_created + expect(pipeline.reload).to be_running + end end + end - it 'retries builds failed builds and marks subsequent for processing' do - service.execute(pipeline) + context 'when pipeline has blocking manual actions defined' do + context 'when pipeline retry should enqueue builds' do + before do + create_build('test', :failed, 0) + create_build('deploy', :canceled, 0, when: :manual, allow_failure: false) + create_build('verify', :canceled, 1) + end + + it 'retries failed builds' do + service.execute(pipeline) + + expect(build('test')).to be_pending + expect(build('deploy')).to be_manual + expect(build('verify')).to be_created + expect(pipeline.reload).to be_running + end + end - expect(build('rspec 1')).to be_pending - expect(build('staging')).to be_manual - expect(build('rspec 2')).to be_created - expect(pipeline.reload).to be_running + context 'when pipeline retry should block pipeline immediately' do + before do + create_build('test', :success, 0) + create_build('deploy:1', :success, 1, when: :manual, allow_failure: false) + create_build('deploy:2', :failed, 1, when: :manual, allow_failure: false) + create_build('verify', :canceled, 2) + end + + it 'reprocesses blocking manual action and blocks pipeline' do + service.execute(pipeline) + + expect(build('deploy:1')).to be_success + expect(build('deploy:2')).to be_manual + expect(build('verify')).to be_created + expect(pipeline.reload).to be_blocked + end end end |