Add spec for both upload and download batch operations on secondary node

parent 80d3cf29
......@@ -96,7 +96,7 @@ class Projects::LfsApiController < Projects::GitHttpClientController
if upload_request? && Gitlab::Geo.secondary?
render(
json: {
message: 'You cannot do writing operations on a secondary GitLab Geo instance'
message: 'You cannot do writing operations on a secondary GitLab Geo instance.'
},
content_type: "application/vnd.git-lfs+json",
status: 403
......
......@@ -860,6 +860,39 @@ describe 'Git LFS API and storage' do
end
end
describe 'when handling lfs batch request on a secondary Geo node' do
let(:authorization) { authorize_user }
let(:project) { create(:project) }
let(:path) { "#{project.http_url_to_repo}/info/lfs/objects/batch" }
let(:body) do
{
'objects' => [
{ 'oid' => sample_oid,
'size' => sample_size }
]
}
end
before do
allow(Gitlab::Geo).to receive(:secondary?) { true }
project.team << [user, :master]
enable_lfs
end
it 'responds with a 200 message on download' do
post_lfs_json path, body.merge('operation' => 'download'), headers
expect(response).to have_http_status(200)
end
it 'responds with a 403 message on upload' do
post_lfs_json path, body.merge('operation' => 'upload'), headers
expect(response).to have_http_status(403)
expect(json_response).to include('message' => 'You cannot do writing operations on a secondary GitLab Geo instance.')
end
end
describe 'when pushing a lfs object' do
before do
enable_lfs
......
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