Commit 5cf1cc6a authored by Micaël Bergeron's avatar Micaël Bergeron

remove the license check

parent 50c08d0e
...@@ -105,7 +105,6 @@ module ObjectStorage ...@@ -105,7 +105,6 @@ module ObjectStorage
included do |base| included do |base|
base.include(ObjectStorage) base.include(ObjectStorage)
before :store, :verify_license!
after :migrate, :delete_migrated_file after :migrate, :delete_migrated_file
end end
...@@ -130,10 +129,6 @@ module ObjectStorage ...@@ -130,10 +129,6 @@ module ObjectStorage
object_store_options.remote_directory object_store_options.remote_directory
end end
def licensed?
License.feature_available?(:object_storage)
end
def serialization_column(model_class, mount_point) def serialization_column(model_class, mount_point)
model_class.uploader_options.dig(mount_point, :mount_on) || mount_point model_class.uploader_options.dig(mount_point, :mount_on) || mount_point
end end
...@@ -248,12 +243,6 @@ module ObjectStorage ...@@ -248,12 +243,6 @@ module ObjectStorage
migrated_file.delete if exists? migrated_file.delete if exists?
end end
def verify_license!(_file)
return if file_storage?
raise(ObjectStorageUnavailable, 'Object Storage feature is missing') unless self.class.licensed?
end
def exists? def exists?
file.present? file.present?
end end
...@@ -274,7 +263,6 @@ module ObjectStorage ...@@ -274,7 +263,6 @@ module ObjectStorage
def schedule_background_upload? def schedule_background_upload?
self.class.object_store_enabled? && self.class.object_store_enabled? &&
self.class.background_upload_enabled? && self.class.background_upload_enabled? &&
self.class.licensed? &&
self.file_storage? self.file_storage?
end end
......
...@@ -683,34 +683,6 @@ describe 'Git LFS API and storage' do ...@@ -683,34 +683,6 @@ describe 'Git LFS API and storage' do
expect(json_response['objects'].first['actions']['upload']['href']).to eq("#{Gitlab.config.gitlab.url}/#{project.full_path}.git/gitlab-lfs/objects/#{sample_oid}/#{sample_size}") expect(json_response['objects'].first['actions']['upload']['href']).to eq("#{Gitlab.config.gitlab.url}/#{project.full_path}.git/gitlab-lfs/objects/#{sample_oid}/#{sample_size}")
expect(json_response['objects'].first['actions']['upload']['header']).to eq('Authorization' => authorization) expect(json_response['objects'].first['actions']['upload']['header']).to eq('Authorization' => authorization)
end end
## EE-specific context
context 'and project is above the limit' do
let(:update_lfs_permissions) do
allow_any_instance_of(EE::Project).to receive_messages(
repository_and_lfs_size: 100.megabytes,
actual_size_limit: 99.megabytes)
end
it 'responds with status 406' do
expect(response).to have_gitlab_http_status(406)
expect(json_response['message']).to eql('Your push has been rejected, because this repository has exceeded its size limit of 99 MB by 1 MB. Please contact your GitLab administrator for more information.')
end
end
context 'and project will go over the limit' do
let(:update_lfs_permissions) do
allow_any_instance_of(EE::Project).to receive_messages(
repository_and_lfs_size: 200.megabytes,
actual_size_limit: 300.megabytes)
end
it 'responds with status 406' do
expect(response).to have_gitlab_http_status(406)
expect(json_response['documentation_url']).to include('/help')
expect(json_response['message']).to eql('Your push has been rejected, because this repository has exceeded its size limit of 300 MB by 50 MB. Please contact your GitLab administrator for more information.')
end
end
end end
describe 'when request is authenticated' do describe 'when request is authenticated' do
...@@ -1049,20 +1021,6 @@ describe 'Git LFS API and storage' do ...@@ -1049,20 +1021,6 @@ describe 'Git LFS API and storage' do
end end
end end
context 'and project has limit enabled but will stay under the limit' do
before do
allow_any_instance_of(EE::Project).to receive_messages(
actual_size_limit: 200,
size_limit_enabled?: true)
put_finalize
end
it 'responds with status 200' do
expect(response).to have_gitlab_http_status(200)
end
end
context 'invalid tempfiles' do context 'invalid tempfiles' do
it 'rejects slashes in the tempfile name (path traversal' do it 'rejects slashes in the tempfile name (path traversal' do
put_finalize('foo/bar') put_finalize('foo/bar')
......
module StubConfiguration module StubConfiguration
def stub_object_storage_uploader(config:, uploader:, remote_directory:, enabled: true, licensed: true, background_upload: false) def stub_object_storage_uploader(config:, uploader:, remote_directory:, enabled: true, background_upload: false)
Fog.mock! Fog.mock!
allow(config).to receive(:enabled) { enabled } allow(config).to receive(:enabled) { enabled }
allow(config).to receive(:background_upload) { background_upload } allow(config).to receive(:background_upload) { background_upload }
stub_licensed_features(object_storage: licensed) unless licensed == :skip
return unless enabled return unless enabled
::Fog::Storage.new(uploader.object_store_credentials).tap do |connection| ::Fog::Storage.new(uploader.object_store_credentials).tap do |connection|
......
...@@ -43,18 +43,6 @@ describe LfsObjectUploader do ...@@ -43,18 +43,6 @@ describe LfsObjectUploader do
lfs_object lfs_object
end end
end end
context 'with object storage unlicenced' do
before do
stub_lfs_object_storage(licensed: false)
end
it 'is skipped' do
expect(ObjectStorage::BackgroundMoveWorker).not_to receive(:perform_async)
lfs_object
end
end
end end
describe 'remote file' do describe 'remote file' do
...@@ -75,16 +63,6 @@ describe LfsObjectUploader do ...@@ -75,16 +63,6 @@ describe LfsObjectUploader do
expect(lfs_object.file.path).not_to be_blank expect(lfs_object.file.path).not_to be_blank
end end
end end
context 'with object storage unlicenced' do
before do
stub_lfs_object_storage(licensed: false)
end
it 'can not store file remotely' do
expect { store_file(lfs_object) }.to raise_error('Object Storage feature is missing')
end
end
end end
def store_file(lfs_object) def store_file(lfs_object)
......
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