diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-31 09:10:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-31 09:10:11 +0300 |
commit | a45caca38668412d5aa14e0c2bcce946b2b8967e (patch) | |
tree | 3d881bf9d225b3b55d1e17893504bdc07f788dc1 /spec/uploaders/packages | |
parent | fb657a511abda2481724f0444c1029e6c2158672 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/uploaders/packages')
-rw-r--r-- | spec/uploaders/packages/package_file_uploader_spec.rb | 71 |
1 files changed, 39 insertions, 32 deletions
diff --git a/spec/uploaders/packages/package_file_uploader_spec.rb b/spec/uploaders/packages/package_file_uploader_spec.rb index f4e72892c8f..e8f4cae7b04 100644 --- a/spec/uploaders/packages/package_file_uploader_spec.rb +++ b/spec/uploaders/packages/package_file_uploader_spec.rb @@ -2,43 +2,50 @@ require 'spec_helper' RSpec.describe Packages::PackageFileUploader do - let(:package_file) { create(:package_file, :xml) } - let(:uploader) { described_class.new(package_file, :file) } - let(:path) { Gitlab.config.packages.storage_path } - - subject { uploader } - - it_behaves_like "builds correct paths", - store_dir: %r[\h{2}/\h{2}], - cache_dir: %r[/packages/tmp/cache], - work_dir: %r[/packages/tmp/work] - - context 'object store is remote' do - before do - stub_package_file_object_storage - end - - include_context 'with storage', described_class::Store::REMOTE - - it_behaves_like "builds correct paths", - store_dir: %r[\h{2}/\h{2}] - end + { + package_file: %r[^\h{2}/\h{2}/\h{64}/packages/\d+/files/\d+$], + debian_package_file: %r[^\h{2}/\h{2}/\h{64}/packages/debian/files/\d+$] + }.each do |factory, store_dir_regex| + context factory.to_s do + let(:package_file) { create(factory) } # rubocop:disable Rails/SaveBang + let(:uploader) { described_class.new(package_file, :file) } + let(:path) { Gitlab.config.packages.storage_path } + + subject { uploader } + + it_behaves_like "builds correct paths", + store_dir: store_dir_regex, + cache_dir: %r[/packages/tmp/cache], + work_dir: %r[/packages/tmp/work] + + context 'object store is remote' do + before do + stub_package_file_object_storage + end + + include_context 'with storage', described_class::Store::REMOTE + + it_behaves_like "builds correct paths", + store_dir: store_dir_regex + end - describe 'remote file' do - let(:package_file) { create(:package_file, :object_storage, :xml) } + describe 'remote file' do + let(:package_file) { create(factory, :object_storage) } - context 'with object storage enabled' do - before do - stub_package_file_object_storage - end + context 'with object storage enabled' do + before do + stub_package_file_object_storage + end - it 'can store file remotely' do - allow(ObjectStorage::BackgroundMoveWorker).to receive(:perform_async) + it 'can store file remotely' do + allow(ObjectStorage::BackgroundMoveWorker).to receive(:perform_async) - package_file + package_file - expect(package_file.file_store).to eq(described_class::Store::REMOTE) - expect(package_file.file.path).not_to be_blank + expect(package_file.file_store).to eq(described_class::Store::REMOTE) + expect(package_file.file.path).not_to be_blank + end + end end end end |