Do not update stage status when it is just created
This commit is contained in:
parent
0e1b3dc41b
commit
887818d3cb
|
@ -74,8 +74,7 @@ module Ci
|
||||||
when 'failed' then drop
|
when 'failed' then drop
|
||||||
when 'canceled' then cancel
|
when 'canceled' then cancel
|
||||||
when 'manual' then block
|
when 'manual' then block
|
||||||
when 'skipped' then skip
|
when 'skipped', nil then skip
|
||||||
else skip
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -65,7 +65,31 @@ describe Ci::Stage, :models do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when stage is skipped' do
|
context 'when stage has only created builds' do
|
||||||
|
let(:stage) { create(:ci_stage_entity, status: :created) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
create(:ci_build, :created, stage_id: stage.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'updates status to skipped' do
|
||||||
|
expect(stage.reload.status).to eq 'created'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when stage is skipped because of skipped builds' do
|
||||||
|
before do
|
||||||
|
create(:ci_build, :skipped, stage_id: stage.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'updates status to skipped' do
|
||||||
|
expect { stage.update_status }
|
||||||
|
.to change { stage.reload.status }
|
||||||
|
.to 'skipped'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when stage is skipped because is empty' do
|
||||||
it 'updates status to skipped' do
|
it 'updates status to skipped' do
|
||||||
expect { stage.update_status }
|
expect { stage.update_status }
|
||||||
.to change { stage.reload.status }
|
.to change { stage.reload.status }
|
||||||
|
|
Loading…
Reference in New Issue