Commit 12caa2af authored by Thong Kuah's avatar Thong Kuah

Merge branch 'mk/add-test-for-push-lfs-over-ssh-on-secondary' into 'master'

Geo: Add test for LFS push over SSH on a secondary node

See merge request gitlab-org/gitlab-ee!16194
parents 27d5fd3b 20049ba0
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe API::Internal do describe API::Internal::Base do
include EE::GeoHelpers
describe "POST /internal/allowed" do describe "POST /internal/allowed" do
set(:user) { create(:user) } set(:user) { create(:user) }
set(:key) { create(:key, user: user) } set(:key) { create(:key, user: user) }
...@@ -144,4 +146,40 @@ describe API::Internal do ...@@ -144,4 +146,40 @@ describe API::Internal do
end end
end end
end end
describe "POST /internal/lfs_authenticate" do
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
let(:secret_token) { Gitlab::Shell.secret_token }
context 'for a secondary node' do
let!(:primary) { create(:geo_node, :primary) }
let!(:secondary) { create(:geo_node) }
before do
stub_current_geo_node(secondary)
project.add_developer(user)
end
it 'returns the repository_http_path at the primary node' do
expect(Project).to receive(:find_by_full_path).and_return(project)
lfs_auth_user(user.id, project)
expect(response).to have_gitlab_http_status(200)
expect(json_response['repository_http_path']).to eq(geo_primary_http_url_to_repo(project))
end
end
def lfs_auth_user(user_id, project)
post(
api("/internal/lfs_authenticate"),
params: {
user_id: user_id,
secret_token: secret_token,
project: project.full_path
}
)
end
end
end end
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