提交 4e3fc212 编写于 作者: G Grzegorz Bizon

Extend specs for canceling a running pipeline

上级 ffcf3c68
......@@ -728,7 +728,7 @@ describe Ci::Pipeline, models: true do
describe '#cancel_running' do
let(:latest_status) { pipeline.statuses.pluck(:status) }
context 'when there is a running external job and created build' do
context 'when there is a running external job and a regular job' do
before do
create(:ci_build, :running, pipeline: pipeline)
create(:generic_commit_status, :running, pipeline: pipeline)
......@@ -741,7 +741,7 @@ describe Ci::Pipeline, models: true do
end
end
context 'when builds are in different stages' do
context 'when jobs are in different stages' do
before do
create(:ci_build, :running, stage_idx: 0, pipeline: pipeline)
create(:ci_build, :running, stage_idx: 1, pipeline: pipeline)
......@@ -753,6 +753,19 @@ describe Ci::Pipeline, models: true do
expect(latest_status).to contain_exactly('canceled', 'canceled')
end
end
context 'when there are created builds present in the pipeline' do
before do
create(:ci_build, :running, stage_idx: 0, pipeline: pipeline)
create(:ci_build, :created, stage_idx: 1, pipeline: pipeline)
pipeline.cancel_running
end
it 'skips created builds' do
expect(latest_status).to eq ['canceled', 'skipped']
end
end
end
describe '#retry_failed' do
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册