diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-17 13:30:49 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-17 13:30:49 +0200 |
commit | 63137d4e5bd8e42d5b95ffac44be71f998148494 (patch) | |
tree | 967a00a0f27f31c7a091b541b8d3f1e4bbfda4a6 /spec | |
parent | a4d301eed047afb800b810432680b8c9134fa40a (diff) | |
download | gitlab-ce-63137d4e5bd8e42d5b95ffac44be71f998148494.tar.gz |
Add specs for pipeline process with auto-retries
This also resolve a possible race condition - a next stage should not
start until are retries are done in a previous one.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/ci/process_pipeline_service_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/services/ci/process_pipeline_service_spec.rb b/spec/services/ci/process_pipeline_service_spec.rb index efcaccc254e..0934833a4fa 100644 --- a/spec/services/ci/process_pipeline_service_spec.rb +++ b/spec/services/ci/process_pipeline_service_spec.rb @@ -463,6 +463,35 @@ describe Ci::ProcessPipelineService, '#execute', :services do end end + context 'when builds with auto-retries are configured' do + before do + create_build('build:1', stage_idx: 0, user: user, options: { retry: 2 }) + create_build('test:1', stage_idx: 1, user: user, when: :on_failure) + create_build('test:2', stage_idx: 1, user: user, options: { retry: 1 }) + end + + it 'automatically retries builds in a valid order' do + expect(process_pipeline).to be_truthy + + fail_running_or_pending + + expect(builds_names).to eq %w[build:1 build:1] + expect(builds_statuses).to eq %w[failed pending] + + succeed_running_or_pending + + expect(builds_names).to eq %w[build:1 build:1 test:2] + expect(builds_statuses).to eq %w[failed success pending] + + succeed_running_or_pending + + expect(builds_names).to eq %w[build:1 build:1 test:2] + expect(builds_statuses).to eq %w[failed success success] + + expect(pipeline.reload).to be_success + end + end + def process_pipeline described_class.new(pipeline.project, user).execute(pipeline) end |