diff --git a/app/uploaders/object_storage.rb b/app/uploaders/object_storage.rb index 95f54b14d04..43d881e5aba 100644 --- a/app/uploaders/object_storage.rb +++ b/app/uploaders/object_storage.rb @@ -105,7 +105,6 @@ module ObjectStorage included do |base| base.include(ObjectStorage) - before :store, :verify_license! after :migrate, :delete_migrated_file end @@ -130,10 +129,6 @@ module ObjectStorage object_store_options.remote_directory end - def licensed? - License.feature_available?(:object_storage) - end - def serialization_column(model_class, mount_point) model_class.uploader_options.dig(mount_point, :mount_on) || mount_point end @@ -248,12 +243,6 @@ module ObjectStorage migrated_file.delete if exists? end - def verify_license!(_file) - return if file_storage? - - raise(ObjectStorageUnavailable, 'Object Storage feature is missing') unless self.class.licensed? - end - def exists? file.present? end @@ -274,7 +263,6 @@ module ObjectStorage def schedule_background_upload? self.class.object_store_enabled? && self.class.background_upload_enabled? && - self.class.licensed? && self.file_storage? end diff --git a/spec/requests/lfs_http_spec.rb b/spec/requests/lfs_http_spec.rb index da7dd936a76..0ddbddb112c 100644 --- a/spec/requests/lfs_http_spec.rb +++ b/spec/requests/lfs_http_spec.rb @@ -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']['header']).to eq('Authorization' => authorization) 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 describe 'when request is authenticated' do @@ -1049,20 +1021,6 @@ describe 'Git LFS API and storage' do 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 it 'rejects slashes in the tempfile name (path traversal' do put_finalize('foo/bar') diff --git a/spec/support/stub_object_storage.rb b/spec/support/stub_object_storage.rb index 93477e513f2..69c59fb0015 100644 --- a/spec/support/stub_object_storage.rb +++ b/spec/support/stub_object_storage.rb @@ -1,12 +1,10 @@ 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! allow(config).to receive(:enabled) { enabled } allow(config).to receive(:background_upload) { background_upload } - stub_licensed_features(object_storage: licensed) unless licensed == :skip - return unless enabled ::Fog::Storage.new(uploader.object_store_credentials).tap do |connection| diff --git a/spec/uploaders/lfs_object_uploader_spec.rb b/spec/uploaders/lfs_object_uploader_spec.rb index fbb4a188646..a2fb3886610 100644 --- a/spec/uploaders/lfs_object_uploader_spec.rb +++ b/spec/uploaders/lfs_object_uploader_spec.rb @@ -43,18 +43,6 @@ describe LfsObjectUploader do lfs_object 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 describe 'remote file' do @@ -75,16 +63,6 @@ describe LfsObjectUploader do expect(lfs_object.file.path).not_to be_blank 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 def store_file(lfs_object)