diff options
author | Shinya Maeda <shinya@gitlab.com> | 2019-01-18 19:15:00 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2019-01-18 19:29:43 +0900 |
commit | 91c1dc578eba70417b05ef0edd961f0717e10c43 (patch) | |
tree | fee045a72d0978b1de4e0afb786e327fa950a1de /spec | |
parent | 35c3cb7c480e812d3c6dcd8f8e2eb6c6a2da83b1 (diff) | |
download | gitlab-ce-91c1dc578eba70417b05ef0edd961f0717e10c43.tar.gz |
Fix runner eternal loop when update job result
Add spec
Add changelog
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/ci/build_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 1afc2436bb5..60d89313f07 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -3028,6 +3028,24 @@ describe Ci::Build do subject.drop! end end + + context 'when associated deployment failed to update its status' do + let(:build) { create(:ci_build, :running, pipeline: pipeline) } + let!(:deployment) { create(:deployment, deployable: build) } + + before do + allow_any_instance_of(Deployment) + .to receive(:drop!).and_raise('Unexpected error') + end + + it 'can drop the build' do + expect(Gitlab::Sentry).to receive(:track_exception) + + expect { build.drop! }.not_to raise_error + + expect(build).to be_failed + end + end end describe '.matches_tag_ids' do |