diff options
author | Stan Hu <stanhu@gmail.com> | 2017-12-24 09:03:58 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-12-24 09:39:08 -0800 |
commit | 36bdf3dc9ac290058b73ab54abeb9ba84b211b29 (patch) | |
tree | 06c13ffa218828c3a82495dbacf56a3f8e89de04 /spec/requests/api/internal_spec.rb | |
parent | 0c8d7e8460f74ba3a2345e42884ed96321fbb897 (diff) | |
download | gitlab-ce-36bdf3dc9ac290058b73ab54abeb9ba84b211b29.tar.gz |
Gracefully handle orphaned write deploy keys in /internal/post_receivesh-handle-orphaned-deploy-keys
On GitLab.com, there are write deploy keys with no associated users.
Pushes with these deploy keys end with an Error 500 since we attempt
to look up redirect message. If there is no user, don't attempt
to display a redirect message.
Closes #41466
Diffstat (limited to 'spec/requests/api/internal_spec.rb')
-rw-r--r-- | spec/requests/api/internal_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb index bbcd1194ae5..7b25047ea8f 100644 --- a/spec/requests/api/internal_spec.rb +++ b/spec/requests/api/internal_spec.rb @@ -784,6 +784,16 @@ describe API::Internal do expect(json_response["redirected_message"]).to eq(project_moved.redirect_message) end end + + context 'with an orphaned write deploy key' do + it 'does not try to notify that project moved' do + allow_any_instance_of(Gitlab::Identifier).to receive(:identify).and_return(nil) + + post api("/internal/post_receive"), valid_params + + expect(response).to have_gitlab_http_status(200) + end + end end describe 'POST /internal/pre_receive' do |