diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-04-19 12:47:34 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-04-28 12:49:46 +0200 |
commit | 60492caa98d7da6d1dd04710c9bc3f762bdceebd (patch) | |
tree | de096b08e69f8454ff8e27b3437813b4e157a0b2 /spec/models/ci/commit_spec.rb | |
parent | 7518330aa197930282121ac489a01987c20b6e00 (diff) | |
download | gitlab-ce-60492caa98d7da6d1dd04710c9bc3f762bdceebd.tar.gz |
Add tests exercising builds scheduler after cancel
Diffstat (limited to 'spec/models/ci/commit_spec.rb')
-rw-r--r-- | spec/models/ci/commit_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/ci/commit_spec.rb b/spec/models/ci/commit_spec.rb index 0bc7722ce6e..6055c142e21 100644 --- a/spec/models/ci/commit_spec.rb +++ b/spec/models/ci/commit_spec.rb @@ -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 |