Commit f0002da0 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Add a test for on_failure jobs in the middle

parent 33bbfd27
......@@ -72,6 +72,7 @@ module HasStatus
quoted_when = connection.quote_column_name('when')
# We want to ignore skipped manual jobs
where("#{quoted_when} <> ? OR status <> ?", 'manual', 'skipped').
# We want to ignore skipped on_failure
where("#{quoted_when} <> ? OR status <> ?", 'on_failure', 'skipped')
end
end
......
......@@ -230,7 +230,7 @@ describe Ci::ProcessPipelineService, services: true do
end
end
context 'when there are manual jobs in earlier stages' do
context 'when there are manual/on_failure jobs in earlier stages' do
before do
builds
process_pipeline
......@@ -266,6 +266,23 @@ describe Ci::ProcessPipelineService, services: true do
end
end
context 'when second stage has only on_failure jobs' do
let(:builds) do
[create_build('check', 0),
create_build('build', 1, 'on_failure'),
create_build('test', 2)]
end
it 'skips second stage and continues on third stage' do
expect(builds.map(&:status)).to eq(%w[pending created created])
builds.first.success
builds.each(&:reload)
expect(builds.map(&:status)).to eq(%w[success skipped pending])
end
end
def create_build(name, stage_idx, when_value = nil)
create(:ci_build,
:created,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment