Commit 60492caa authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add tests exercising builds scheduler after cancel

parent 7518330a
......@@ -258,6 +258,24 @@ describe Ci::Commit, models: true do
expect(commit.status).to eq('failed')
end
end
context 'when build is canceled in the second stage' do
it 'does not schedule builds after build has been canceled' do
expect(create_builds).to be_truthy
expect(commit.builds.pluck(:name)).to contain_exactly('build')
expect(commit.builds.pluck(:status)).to contain_exactly('pending')
commit.builds.running_or_pending.each(&:success)
expect(commit.builds.running_or_pending).to_not be_empty
expect(commit.builds.pluck(:name)).to contain_exactly('build', 'test')
expect(commit.builds.pluck(:status)).to contain_exactly('success', 'pending')
commit.builds.running_or_pending.each(&:cancel)
expect(commit.builds.running_or_pending).to be_empty
expect(commit.reload.status).to eq('canceled')
end
end
end
end
......
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