Add a test for on_failure jobs in the middle
This commit is contained in:
parent
33bbfd277b
commit
f0002da09c
2 changed files with 19 additions and 1 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue