diff options
author | Tiger <twatson@gitlab.com> | 2019-04-15 04:09:30 +0300 |
---|---|---|
committer | Tiger <twatson@gitlab.com> | 2019-04-15 05:44:00 +0300 |
commit | 781cd4a29d89ae2cd24329ca33d59b5d959617d2 (patch) | |
tree | 088694553309fae8d72976712defb72060d621f5 /spec/services | |
parent | 0a99e0220d9371423039f05f700af3675b26624f (diff) |
Rescue and log errors raised when preparing builds
https://gitlab.com/gitlab-org/gitlab-ce/issues/60480
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/ci/prepare_build_service_spec.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/services/ci/prepare_build_service_spec.rb b/spec/services/ci/prepare_build_service_spec.rb index 1797f8f964f..2d027f13e52 100644 --- a/spec/services/ci/prepare_build_service_spec.rb +++ b/spec/services/ci/prepare_build_service_spec.rb @@ -38,7 +38,21 @@ describe Ci::PrepareBuildService do end it 'drops the build' do - expect(build).to receive(:drop!).with(:unmet_prerequisites).once + expect(build).to receive(:drop).with(:unmet_prerequisites).once + + subject + end + end + + context 'prerequisites raise an error' do + before do + allow(prerequisite).to receive(:complete!).and_raise Kubeclient::HttpError.new(401, 'unauthorized', nil) + end + + it 'drops the build and notifies Sentry' do + expect(build).to receive(:drop).with(:unmet_prerequisites).once + expect(Gitlab::Sentry).to receive(:track_acceptable_exception) + .with(instance_of(Kubeclient::HttpError), hash_including(extra: { build_id: build.id })) subject end |