diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /spec/models/ci/build_spec.rb | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) | |
download | gitlab-ce-7e9c479f7de77702622631cff2628a9c8dcbc627.tar.gz |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/models/ci/build_spec.rb')
-rw-r--r-- | spec/models/ci/build_spec.rb | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index f1d51324bbf..5ff9b4dd493 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -2464,7 +2464,7 @@ RSpec.describe Ci::Build do end before do - allow(Gitlab::Ci::Jwt).to receive(:for_build).with(build).and_return('ci.job.jwt') + allow(Gitlab::Ci::Jwt).to receive(:for_build).and_return('ci.job.jwt') build.set_token('my-token') build.yaml_variables = [] end @@ -2482,12 +2482,17 @@ RSpec.describe Ci::Build do end context 'when CI_JOB_JWT generation fails' do - it 'CI_JOB_JWT is not included' do - expect(Gitlab::Ci::Jwt).to receive(:for_build).and_raise(OpenSSL::PKey::RSAError, 'Neither PUB key nor PRIV key: not enough data') - expect(Gitlab::ErrorTracking).to receive(:track_exception) - - expect { subject }.not_to raise_error - expect(subject.pluck(:key)).not_to include('CI_JOB_JWT') + [ + OpenSSL::PKey::RSAError, + Gitlab::Ci::Jwt::NoSigningKeyError + ].each do |reason_to_fail| + it 'CI_JOB_JWT is not included' do + expect(Gitlab::Ci::Jwt).to receive(:for_build).and_raise(reason_to_fail) + expect(Gitlab::ErrorTracking).to receive(:track_exception) + + expect { subject }.not_to raise_error + expect(subject.pluck(:key)).not_to include('CI_JOB_JWT') + end end end |