Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-01-09 00:10:30 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-01-09 00:10:30 +0300
commita0cbad8bf4239004a472b704b5eb33d56898e816 (patch)
tree9abeeb471e483c29346aa1765578f7d10711fdba /spec/uploaders
parent9bcb655610575956a858ae6fdb1d00deef5f6ad8 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/uploaders')
-rw-r--r--spec/uploaders/packages/debian/distribution_release_file_uploader_spec.rb52
1 files changed, 52 insertions, 0 deletions
diff --git a/spec/uploaders/packages/debian/distribution_release_file_uploader_spec.rb b/spec/uploaders/packages/debian/distribution_release_file_uploader_spec.rb
new file mode 100644
index 00000000000..d36bfac4de8
--- /dev/null
+++ b/spec/uploaders/packages/debian/distribution_release_file_uploader_spec.rb
@@ -0,0 +1,52 @@
+# frozen_string_literal: true
+require 'spec_helper'
+
+RSpec.describe Packages::Debian::DistributionReleaseFileUploader do
+ [:project, :group].each do |container_type|
+ context "Packages::Debian::#{container_type.capitalize}Distribution" do
+ let(:factory) { "debian_#{container_type}_distribution" }
+ let(:distribution) { create(factory, :with_file) }
+ let(:uploader) { described_class.new(distribution, :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}/debian_#{container_type}_distribution/\d+$],
+ 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}/\h{64}/debian_#{container_type}_distribution/\d+$],
+ cache_dir: %r[/packages/tmp/cache$],
+ work_dir: %r[/packages/tmp/work$]
+ end
+
+ describe 'remote file' do
+ let(:distribution) { create(factory, :with_file, :object_storage) }
+
+ 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)
+
+ distribution
+
+ expect(distribution.file_store).to eq(described_class::Store::REMOTE)
+ expect(distribution.file.path).not_to be_blank
+ end
+ end
+ end
+ end
+ end
+end