diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/uploaders/packages/composer/cache_uploader_spec.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/uploaders/packages/composer/cache_uploader_spec.rb')
-rw-r--r-- | spec/uploaders/packages/composer/cache_uploader_spec.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/uploaders/packages/composer/cache_uploader_spec.rb b/spec/uploaders/packages/composer/cache_uploader_spec.rb new file mode 100644 index 00000000000..a4ba4cc2a1e --- /dev/null +++ b/spec/uploaders/packages/composer/cache_uploader_spec.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true +require 'spec_helper' + +RSpec.describe Packages::Composer::CacheUploader do + let(:cache_file) { create(:composer_cache_file) } # rubocop:disable Rails/SaveBang + let(:uploader) { described_class.new(cache_file, :file) } + let(:path) { Gitlab.config.packages.storage_path } + + subject { uploader } + + it_behaves_like "builds correct paths", + store_dir: %r[^\h{2}/\h{2}/\h{64}/packages/composer_cache/\d+$], + cache_dir: %r[/packages/tmp/cache], + work_dir: %r[/packages/tmp/work] + + context 'object store is remote' do + before do + stub_composer_cache_object_storage + end + + include_context 'with storage', described_class::Store::REMOTE + + it_behaves_like "builds correct paths", + store_dir: %r[^\h{2}/\h{2}/\h{64}/packages/composer_cache/\d+$] + end + + describe 'remote file' do + let(:cache_file) { create(:composer_cache_file, :object_storage) } + + context 'with object storage enabled' do + before do + stub_composer_cache_object_storage + end + + it 'can store file remotely' do + allow(ObjectStorage::BackgroundMoveWorker).to receive(:perform_async) + + cache_file + + expect(cache_file.file_store).to eq(described_class::Store::REMOTE) + expect(cache_file.file.path).not_to be_blank + end + end + end +end |