summaryrefslogtreecommitdiff
path: root/spec/services/ci/process_pipeline_service_spec.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-09-30 03:41:38 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-09-30 03:41:38 +0800
commit6053acf5e6cee3ceceb1010ed77f1ce71099d5e1 (patch)
treebcc7a97dd84481cec5350de456da1cc081c0a451 /spec/services/ci/process_pipeline_service_spec.rb
parent385c602bd0e45418ccc10893f8f472584ba95551 (diff)
downloadgitlab-ce-6053acf5e6cee3ceceb1010ed77f1ce71099d5e1.tar.gz
We consider skipped = success, fixes #22598
Diffstat (limited to 'spec/services/ci/process_pipeline_service_spec.rb')
-rw-r--r--spec/services/ci/process_pipeline_service_spec.rb49
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