diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/services/container_expiration_policy_service_spec.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/services/container_expiration_policy_service_spec.rb')
-rw-r--r-- | spec/services/container_expiration_policy_service_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/services/container_expiration_policy_service_spec.rb b/spec/services/container_expiration_policy_service_spec.rb index b2f2b2e1236..97715b990ef 100644 --- a/spec/services/container_expiration_policy_service_spec.rb +++ b/spec/services/container_expiration_policy_service_spec.rb @@ -27,5 +27,20 @@ describe ContainerExpirationPolicyService do expect(container_expiration_policy.next_run_at).to be > Time.zone.now end + + context 'with an invalid container expiration policy' do + before do + allow(container_expiration_policy).to receive(:valid?).and_return(false) + end + + it 'disables it' do + expect(container_expiration_policy).not_to receive(:schedule_next_run!) + expect(CleanupContainerRepositoryWorker).not_to receive(:perform_async) + + expect { subject } + .to change { container_expiration_policy.reload.enabled }.from(true).to(false) + .and raise_error(ContainerExpirationPolicyService::InvalidPolicyError) + end + end end end |