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-12-16 21:14:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-16 21:14:09 +0300
commitcab5a484fe5153edc5463603923491b1487faa5f (patch)
tree70ab8059b964452839165c99a48d2223536ca769 /spec/workers/purge_dependency_proxy_cache_worker_spec.rb
parent6aaec2fc6c3e3f96f443b96fd53ae9ed5e7979af (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers/purge_dependency_proxy_cache_worker_spec.rb')
-rw-r--r--spec/workers/purge_dependency_proxy_cache_worker_spec.rb31
1 files changed, 14 insertions, 17 deletions
diff --git a/spec/workers/purge_dependency_proxy_cache_worker_spec.rb b/spec/workers/purge_dependency_proxy_cache_worker_spec.rb
index 393745958be..b928104fb58 100644
--- a/spec/workers/purge_dependency_proxy_cache_worker_spec.rb
+++ b/spec/workers/purge_dependency_proxy_cache_worker_spec.rb
@@ -4,18 +4,18 @@ require 'spec_helper'
RSpec.describe PurgeDependencyProxyCacheWorker do
let_it_be(:user) { create(:admin) }
- let_it_be(:blob) { create(:dependency_proxy_blob )}
- let_it_be(:group, reload: true) { blob.group }
- let_it_be(:manifest) { create(:dependency_proxy_manifest, group: group )}
+ let_it_be_with_refind(:blob) { create(:dependency_proxy_blob )}
+ let_it_be_with_reload(:group) { blob.group }
+ let_it_be_with_refind(:manifest) { create(:dependency_proxy_manifest, group: group )}
let_it_be(:group_id) { group.id }
subject { described_class.new.perform(user.id, group_id) }
describe '#perform' do
- shared_examples 'not removing blobs and manifests' do
- it 'does not remove blobs and manifests', :aggregate_failures do
- expect { subject }.not_to change { group.dependency_proxy_blobs.size }
- expect { subject }.not_to change { group.dependency_proxy_manifests.size }
+ shared_examples 'not expiring blobs and manifests' do
+ it 'does not expire blobs and manifests', :aggregate_failures do
+ expect { subject }.not_to change { blob.status }
+ expect { subject }.not_to change { manifest.status }
expect(subject).to be_nil
end
end
@@ -25,39 +25,36 @@ RSpec.describe PurgeDependencyProxyCacheWorker do
include_examples 'an idempotent worker' do
let(:job_args) { [user.id, group_id] }
- it 'deletes the blobs and returns ok', :aggregate_failures do
- expect(group.dependency_proxy_blobs.size).to eq(1)
- expect(group.dependency_proxy_manifests.size).to eq(1)
-
+ it 'expires the blobs and returns ok', :aggregate_failures do
subject
- expect(group.dependency_proxy_blobs.size).to eq(0)
- expect(group.dependency_proxy_manifests.size).to eq(0)
+ expect(blob).to be_expired
+ expect(manifest).to be_expired
end
end
end
context 'when admin mode is disabled' do
- it_behaves_like 'not removing blobs and manifests'
+ it_behaves_like 'not expiring blobs and manifests'
end
end
context 'a non-admin user' do
let(:user) { create(:user) }
- it_behaves_like 'not removing blobs and manifests'
+ it_behaves_like 'not expiring blobs and manifests'
end
context 'an invalid user id' do
let(:user) { double('User', id: 99999 ) }
- it_behaves_like 'not removing blobs and manifests'
+ it_behaves_like 'not expiring blobs and manifests'
end
context 'an invalid group' do
let(:group_id) { 99999 }
- it_behaves_like 'not removing blobs and manifests'
+ it_behaves_like 'not expiring blobs and manifests'
end
end
end