diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-16 09:08:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-16 09:08:27 +0300 |
commit | 36c3f8296f0309642d3b41b7d0e0333e50ac75a6 (patch) | |
tree | 86fc05e07f33599ae15319251d17b5060c6c52af /spec/workers | |
parent | e8d7ac4f14bcc70921ea9d63c75cd2e7f2cd5c31 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/container_expiration_policy_worker_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/workers/container_expiration_policy_worker_spec.rb b/spec/workers/container_expiration_policy_worker_spec.rb index 48ab1614633..b15a28dcdca 100644 --- a/spec/workers/container_expiration_policy_worker_spec.rb +++ b/spec/workers/container_expiration_policy_worker_spec.rb @@ -53,5 +53,22 @@ describe ContainerExpirationPolicyWorker do subject end end + + context 'an invalid policy' do + let_it_be(:container_expiration_policy) { create(:container_expiration_policy, :runnable) } + let_it_be(:user) {container_expiration_policy.project.owner } + + before do + container_expiration_policy.update_column(:name_regex, '*production') + end + + it 'runs the policy and tracks an error' do + expect(ContainerExpirationPolicyService) + .to receive(:new).with(container_expiration_policy.project, user).and_call_original + expect(Gitlab::ErrorTracking).to receive(:log_exception).with(instance_of(ContainerExpirationPolicyService::InvalidPolicyError), container_expiration_policy_id: container_expiration_policy.id) + + expect { subject }.to change { container_expiration_policy.reload.enabled }.from(true).to(false) + end + end end end |