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-07-20 12:55:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-20 12:55:51 +0300
commite8d2c2579383897a1dd7f9debd359abe8ae8373d (patch)
treec42be41678c2586d49a75cabce89322082698334 /spec/workers/container_expiration_policies
parentfc845b37ec3a90aaa719975f607740c22ba6a113 (diff)
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'spec/workers/container_expiration_policies')
-rw-r--r--spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb45
1 files changed, 20 insertions, 25 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 c399697cbe0..506124216af 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
@@ -413,20 +413,30 @@ RSpec.describe ContainerExpirationPolicies::CleanupContainerRepositoryWorker do
disabled_repository.project.container_expiration_policy.update_column(:enabled, false)
end
+ context 'counts and capacity' do
+ where(:scheduled_count, :unfinished_count, :capacity, :expected_count) do
+ 2 | 2 | 10 | 4
+ 2 | 0 | 10 | 2
+ 0 | 2 | 10 | 2
+ 4 | 2 | 2 | 4
+ 4 | 0 | 2 | 4
+ 0 | 4 | 2 | 4
+ end
+
+ with_them do
+ before do
+ allow(worker).to receive(:cleanup_scheduled_count).and_return(scheduled_count)
+ allow(worker).to receive(:cleanup_unfinished_count).and_return(unfinished_count)
+ end
+
+ it { is_expected.to eq(expected_count) }
+ end
+ end
+
context 'with container repositories waiting for cleanup' do
let_it_be(:unfinished_repositories) { create_list(:container_repository, 2, :cleanup_unfinished) }
it { is_expected.to eq(3) }
-
- it 'logs the work count' do
- expect_log_info(
- cleanup_scheduled_count: 1,
- cleanup_unfinished_count: 2,
- cleanup_total_count: 3
- )
-
- subject
- end
end
context 'with no container repositories waiting for cleanup' do
@@ -436,16 +446,6 @@ RSpec.describe ContainerExpirationPolicies::CleanupContainerRepositoryWorker do
end
it { is_expected.to eq(0) }
-
- it 'logs 0 work count' do
- expect_log_info(
- cleanup_scheduled_count: 0,
- cleanup_unfinished_count: 0,
- cleanup_total_count: 0
- )
-
- subject
- end
end
end
@@ -468,9 +468,4 @@ RSpec.describe ContainerExpirationPolicies::CleanupContainerRepositoryWorker do
it { is_expected.to eq(0) }
end
end
-
- def expect_log_info(structure)
- expect(worker.logger)
- .to receive(:info).with(worker.structured_payload(structure))
- end
end