summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-10-07 11:01:21 +0000
committerDouwe Maan <douwe@gitlab.com>2017-10-07 11:01:21 +0000
commit546b18b90317c0c9c0163ddcc5c54798a0bed841 (patch)
treeff10c1965e629113b25be892a72c0f181f1b8671 /spec/requests
parent3cb798357fbfb8b3230b60130fc1c6b328ae84b7 (diff)
parentd13669716ab0c31ce9039ae9f7f073e33a4dc40f (diff)
downloadgitlab-ce-546b18b90317c0c9c0163ddcc5c54798a0bed841.tar.gz
Merge branch 'tc-geo-read-only-idea' into 'master'
Create idea of read-only database Closes #37534 See merge request gitlab-org/gitlab-ce!14688
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/lfs_http_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/requests/lfs_http_spec.rb b/spec/requests/lfs_http_spec.rb
index badc8bccf84..bca5bf81c5c 100644
--- a/spec/requests/lfs_http_spec.rb
+++ b/spec/requests/lfs_http_spec.rb
@@ -825,6 +825,34 @@ describe 'Git LFS API and storage' do
end
end
+ describe 'when handling lfs batch request on a read-only GitLab instance' 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::Database).to receive(:read_only?) { 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_gitlab_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_gitlab_http_status(403)
+ expect(json_response).to include('message' => 'You cannot write to this read-only GitLab instance.')
+ end
+ end
+
describe 'when pushing a lfs object' do
before do
enable_lfs