diff options
Diffstat (limited to 'spec/services/ci')
-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 |