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:
Diffstat (limited to 'spec/workers/dependency_proxy/cleanup_dependency_proxy_worker_spec.rb')
-rw-r--r--spec/workers/dependency_proxy/cleanup_dependency_proxy_worker_spec.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/workers/dependency_proxy/cleanup_dependency_proxy_worker_spec.rb b/spec/workers/dependency_proxy/cleanup_dependency_proxy_worker_spec.rb
new file mode 100644
index 00000000000..ed0bdefbdb8
--- /dev/null
+++ b/spec/workers/dependency_proxy/cleanup_dependency_proxy_worker_spec.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe DependencyProxy::CleanupDependencyProxyWorker do
+ describe '#perform' do
+ subject { described_class.new.perform }
+
+ context 'when there are records to be deleted' do
+ it_behaves_like 'an idempotent worker' do
+ it 'queues the cleanup jobs', :aggregate_failures do
+ create(:dependency_proxy_blob, :expired)
+ create(:dependency_proxy_manifest, :expired)
+
+ expect(DependencyProxy::CleanupBlobWorker).to receive(:perform_with_capacity).twice
+ expect(DependencyProxy::CleanupManifestWorker).to receive(:perform_with_capacity).twice
+
+ subject
+ end
+ end
+ end
+
+ context 'when there are not records to be deleted' do
+ it_behaves_like 'an idempotent worker' do
+ it 'does not queue the cleanup jobs', :aggregate_failures do
+ expect(DependencyProxy::CleanupBlobWorker).not_to receive(:perform_with_capacity)
+ expect(DependencyProxy::CleanupManifestWorker).not_to receive(:perform_with_capacity)
+
+ subject
+ end
+ end
+ end
+ end
+end