SSHUploadPack over Gitaly is now OptOut

- Better gitaly-handling in /api/internal/allowed specs
This commit is contained in:
Kim "BKC" Carlbäcker 2017-11-28 11:17:57 +01:00
parent 8ab0fceeef
commit a402056472
2 changed files with 6 additions and 10 deletions

View File

@ -2,8 +2,8 @@ module API
module Helpers
module InternalHelpers
SSH_GITALY_FEATURES = {
'git-receive-pack' => :ssh_receive_pack,
'git-upload-pack' => :ssh_upload_pack
'git-receive-pack' => [:ssh_receive_pack, Gitlab::GitalyClient::MigrationStatus::OPT_IN],
'git-upload-pack' => [:ssh_upload_pack, Gitlab::GitalyClient::MigrationStatus::OPT_OUT]
}.freeze
def wiki?
@ -102,8 +102,8 @@ module API
# Return the Gitaly Address if it is enabled
def gitaly_payload(action)
feature = SSH_GITALY_FEATURES[action]
return unless feature && Gitlab::GitalyClient.feature_enabled?(feature)
feature, status = SSH_GITALY_FEATURES[action]
return unless feature && Gitlab::GitalyClient.feature_enabled?(feature, status: status)
{
repository: repository.gitaly_repository,

View File

@ -269,9 +269,8 @@ describe API::Internal do
end
context "git pull" do
context "gitaly disabled" do
context "gitaly disabled", :disable_gitaly do
it "has the correct payload" do
allow(Gitlab::GitalyClient).to receive(:feature_enabled?).with(:ssh_upload_pack).and_return(false)
pull(key, project)
expect(response).to have_gitlab_http_status(200)
@ -285,7 +284,6 @@ describe API::Internal do
context "gitaly enabled" do
it "has the correct payload" do
allow(Gitlab::GitalyClient).to receive(:feature_enabled?).with(:ssh_upload_pack).and_return(true)
pull(key, project)
expect(response).to have_gitlab_http_status(200)
@ -304,9 +302,8 @@ describe API::Internal do
end
context "git push" do
context "gitaly disabled" do
context "gitaly disabled", :disable_gitaly do
it "has the correct payload" do
allow(Gitlab::GitalyClient).to receive(:feature_enabled?).with(:ssh_receive_pack).and_return(false)
push(key, project)
expect(response).to have_gitlab_http_status(200)
@ -320,7 +317,6 @@ describe API::Internal do
context "gitaly enabled" do
it "has the correct payload" do
allow(Gitlab::GitalyClient).to receive(:feature_enabled?).with(:ssh_receive_pack).and_return(true)
push(key, project)
expect(response).to have_gitlab_http_status(200)