diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 07:33:21 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 07:33:21 +0000 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/workers/cleanup_container_repository_worker_spec.rb | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) | |
download | gitlab-ce-36a59d088eca61b834191dacea009677a96c052f.tar.gz |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/workers/cleanup_container_repository_worker_spec.rb')
-rw-r--r-- | spec/workers/cleanup_container_repository_worker_spec.rb | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/spec/workers/cleanup_container_repository_worker_spec.rb b/spec/workers/cleanup_container_repository_worker_spec.rb index 6723ea2049d..edb815f426d 100644 --- a/spec/workers/cleanup_container_repository_worker_spec.rb +++ b/spec/workers/cleanup_container_repository_worker_spec.rb @@ -13,11 +13,11 @@ RSpec.describe CleanupContainerRepositoryWorker, :clean_gitlab_redis_shared_stat let(:service) { instance_double(Projects::ContainerRepository::CleanupTagsService) } context 'bulk delete api' do - let(:params) { { key: 'value', 'container_expiration_policy' => false } } + let(:params) { { key: 'value' } } it 'executes the destroy service' do expect(Projects::ContainerRepository::CleanupTagsService).to receive(:new) - .with(repository, user, params.merge('container_expiration_policy' => false)) + .with(repository, user, params) .and_return(service) expect(service).to receive(:execute) @@ -36,40 +36,5 @@ RSpec.describe CleanupContainerRepositoryWorker, :clean_gitlab_redis_shared_stat end.not_to raise_error end end - - context 'container expiration policy' do - let(:params) { { key: 'value', 'container_expiration_policy' => true } } - - before do - allow(ContainerRepository) - .to receive(:find_by_id).with(repository.id).and_return(repository) - end - - it 'executes the destroy service' do - expect(repository).to receive(:start_expiration_policy!).and_call_original - expect(repository).to receive(:reset_expiration_policy_started_at!).and_call_original - expect(Projects::ContainerRepository::CleanupTagsService).to receive(:new) - .with(repository, nil, params.merge('container_expiration_policy' => true)) - .and_return(service) - - expect(service).to receive(:execute).and_return(status: :success) - - subject.perform(nil, repository.id, params) - expect(repository.reload.expiration_policy_started_at).to be_nil - end - - it "doesn't reset the expiration policy started at if the destroy service returns an error" do - expect(repository).to receive(:start_expiration_policy!).and_call_original - expect(repository).not_to receive(:reset_expiration_policy_started_at!) - expect(Projects::ContainerRepository::CleanupTagsService).to receive(:new) - .with(repository, nil, params.merge('container_expiration_policy' => true)) - .and_return(service) - - expect(service).to receive(:execute).and_return(status: :error, message: 'timeout while deleting tags') - - subject.perform(nil, repository.id, params) - expect(repository.reload.expiration_policy_started_at).not_to be_nil - end - end end end |