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/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb')
-rw-r--r-- | spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb b/spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb index e6592f7f204..eb4faaed769 100644 --- a/spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb +++ b/spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb @@ -82,6 +82,7 @@ RSpec.describe ContainerExpirationPolicies::CleanupContainerRepositoryWorker do it 'skips the repository' do expect(ContainerExpirationPolicies::CleanupService).not_to receive(:new) expect(worker).to receive(:log_extra_metadata_on_done).with(:container_repository_id, repository.id) + expect(worker).to receive(:log_extra_metadata_on_done).with(:project_id, repository.project.id) expect(worker).to receive(:log_extra_metadata_on_done).with(:cleanup_status, :skipped) expect { subject }.to change { ContainerRepository.waiting_for_cleanup.count }.from(1).to(0) @@ -198,7 +199,7 @@ RSpec.describe ContainerExpirationPolicies::CleanupContainerRepositoryWorker do end end - def cleanup_service_response(status: :finished, repository:, cleanup_tags_service_original_size: 100, cleanup_tags_service_before_truncate_size: 80, cleanup_tags_service_after_truncate_size: 80, cleanup_tags_service_before_delete_size: 50) + def cleanup_service_response(status: :finished, repository:, cleanup_tags_service_original_size: 100, cleanup_tags_service_before_truncate_size: 80, cleanup_tags_service_after_truncate_size: 80, cleanup_tags_service_before_delete_size: 50, cleanup_tags_service_deleted_size: 50) ServiceResponse.success( message: "cleanup #{status}", payload: { @@ -213,13 +214,16 @@ RSpec.describe ContainerExpirationPolicies::CleanupContainerRepositoryWorker do end def expect_log_extra_metadata(service_response:, cleanup_status: :finished, truncated: false) - expect(worker).to receive(:log_extra_metadata_on_done).with(:cleanup_status, cleanup_status) expect(worker).to receive(:log_extra_metadata_on_done).with(:container_repository_id, repository.id) - %i[cleanup_tags_service_original_size cleanup_tags_service_before_truncate_size cleanup_tags_service_after_truncate_size cleanup_tags_service_before_delete_size].each do |field| + expect(worker).to receive(:log_extra_metadata_on_done).with(:project_id, repository.project.id) + expect(worker).to receive(:log_extra_metadata_on_done).with(:cleanup_status, cleanup_status) + + %i[cleanup_tags_service_original_size cleanup_tags_service_before_truncate_size cleanup_tags_service_after_truncate_size cleanup_tags_service_before_delete_size cleanup_tags_service_deleted_size].each do |field| value = service_response.payload[field] expect(worker).to receive(:log_extra_metadata_on_done).with(field, value) unless value.nil? end expect(worker).to receive(:log_extra_metadata_on_done).with(:cleanup_tags_service_truncated, truncated) + expect(worker).to receive(:log_extra_metadata_on_done).with(:running_jobs_count, 0) end end |