diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-09-30 03:41:38 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-09-30 03:41:38 +0800 |
commit | 6053acf5e6cee3ceceb1010ed77f1ce71099d5e1 (patch) | |
tree | bcc7a97dd84481cec5350de456da1cc081c0a451 /spec | |
parent | 385c602bd0e45418ccc10893f8f472584ba95551 (diff) | |
download | gitlab-ce-6053acf5e6cee3ceceb1010ed77f1ce71099d5e1.tar.gz |
We consider skipped = success, fixes #22598
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/ci/process_pipeline_service_spec.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/services/ci/process_pipeline_service_spec.rb b/spec/services/ci/process_pipeline_service_spec.rb index e55daabe5a7..b6c23002dda 100644 --- a/spec/services/ci/process_pipeline_service_spec.rb +++ b/spec/services/ci/process_pipeline_service_spec.rb @@ -230,6 +230,55 @@ describe Ci::ProcessPipelineService, services: true do end end + context 'when there are manual jobs in earlier stages' do + before do + builds + process_pipeline + builds.each(&:reload) + end + + context 'when first stage has only manual jobs' do + let(:builds) do + [create_build('build', 0, 'manual'), + create_build('check', 1), + create_build('test', 2)] + end + + it 'starts from the second stage' do + expect(builds.map(&:status)).to contain_exactly( + 'skipped', 'pending', 'created') + end + end + + context 'when second stage has only manual jobs' do + let(:builds) do + [create_build('check', 0), + create_build('build', 1, 'manual'), + create_build('test', 2)] + end + + it 'skips second stage and continues on third stage' do + expect(builds.map(&:status)).to contain_exactly( + 'pending', 'created', 'created') + + builds.first.success + builds.each(&:reload) + + expect(builds.map(&:status)).to contain_exactly( + 'success', 'skipped', 'pending') + end + end + + def create_build(name, stage_idx, when_value = nil) + create(:ci_build, + :created, + pipeline: pipeline, + name: name, + stage_idx: stage_idx, + when: when_value) + end + end + context 'when failed build in the middle stage is retried' do context 'when failed build is the only unsuccessful build in the stage' do before do |