Commit 2f042494 authored by Michael Kozono's avatar Michael Kozono

Merge branch 'cat-geo-redirect-pulls-different-path' into 'master'

Redirect Geo HTTP(s) pulls to different path with missing repo

See merge request gitlab-org/gitlab!72881
parents 78ac930b c98b0434
......@@ -212,13 +212,7 @@ module EE
end
def geo_primary_full_url
path = if geo_route_helper.not_yet_replicated_redirect?
# git clone/pull
geo_request_fullpath_for_primary
else
# git push
File.join(geo_secondary_referrer_path_prefix, geo_request_fullpath_for_primary)
end
path = File.join(geo_secondary_referrer_path_prefix, geo_request_fullpath_for_primary)
::Gitlab::Utils.append_path(::Gitlab::Geo.primary_node.url, path)
end
......
......@@ -143,7 +143,8 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
let_it_be(:project_with_repo_but_not_synced) { create(:project, :repository, :private) }
let_it_be(:project) { project_with_repo_but_not_synced }
let(:redirect_url) { "#{primary_url}/#{project_with_repo_but_not_synced.full_path}.git/info/refs?service=git-upload-pack" }
let(:endpoint_path) { "/#{project_with_repo_but_not_synced.full_path}.git/info/refs?service=git-upload-pack" }
let(:redirect_url) { redirected_primary_url }
before do
create(:geo_project_registry, :synced, project: project_with_repo_but_not_synced, last_repository_successful_sync_at: nil)
......@@ -180,7 +181,8 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
context 'when the repository does not exist' do
let_it_be(:project) { project_no_repo }
let(:redirect_url) { "#{primary_url}/#{project.full_path}.git/info/refs?service=git-upload-pack" }
let(:endpoint_path) { "/#{project.full_path}.git/info/refs?service=git-upload-pack" }
let(:redirect_url) { redirected_primary_url }
it_behaves_like 'a Geo 302 redirect to Primary'
......@@ -262,7 +264,8 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
context 'when the repository does not exist' do
let_it_be(:project) { project_no_repo }
let(:redirect_url) { "#{primary_url}/#{project.full_path}.git/git-upload-pack" }
let(:endpoint_path) { "/#{project.full_path}.git/git-upload-pack" }
let(:redirect_url) { redirected_primary_url }
it_behaves_like 'a Geo 302 redirect to Primary'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment