Commit 4f6a4289 authored by Vasilii Iakliushin's avatar Vasilii Iakliushin

Merge branch 'id-specify-max-size-for-dependency-proxy' into 'master'

Specify maximum size for Dependency Proxy upload

See merge request gitlab-org/gitlab!72610
parents bda1af7e 5bb0d1ff
......@@ -59,7 +59,7 @@ class Groups::DependencyProxyForContainersController < ::Groups::DependencyProxy
def authorize_upload_blob
set_workhorse_internal_api_content_type
render json: DependencyProxy::FileUploader.workhorse_authorize(has_length: false)
render json: DependencyProxy::FileUploader.workhorse_authorize(has_length: false, maximum_size: 5.gigabytes)
end
def upload_blob
......
......@@ -397,11 +397,24 @@ RSpec.describe Groups::DependencyProxyForContainersController do
group.add_guest(user)
end
it 'sends Workhorse file upload instructions', :aggregate_failures do
it 'sends Workhorse local file instructions', :aggregate_failures do
authorize_upload_blob
expect(response.headers['Content-Type']).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response['TempPath']).to eq(DependencyProxy::FileUploader.workhorse_local_upload_path)
expect(json_response['RemoteObject']).to be_nil
expect(json_response['MaximumSize']).to eq(5.gigabytes)
end
it 'sends Workhorse remote object instructions', :aggregate_failures do
stub_dependency_proxy_object_storage(direct_upload: true)
authorize_upload_blob
expect(response.headers['Content-Type']).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
expect(json_response['TempPath']).to be_nil
expect(json_response['RemoteObject']).not_to be_nil
expect(json_response['MaximumSize']).to eq(5.gigabytes)
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