summaryrefslogtreecommitdiff
path: root/spec/requests/api/ci/runner/jobs_put_spec.rb
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2021-01-20 13:34:23 -0600
committerRobert Speicher <rspeicher@gmail.com>2021-01-20 13:34:23 -0600
commit6438df3a1e0fb944485cebf07976160184697d72 (patch)
tree00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/requests/api/ci/runner/jobs_put_spec.rb
parent42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff)
downloadgitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/requests/api/ci/runner/jobs_put_spec.rb')
-rw-r--r--spec/requests/api/ci/runner/jobs_put_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/requests/api/ci/runner/jobs_put_spec.rb b/spec/requests/api/ci/runner/jobs_put_spec.rb
index e9d793d5a22..f4c99307b1a 100644
--- a/spec/requests/api/ci/runner/jobs_put_spec.rb
+++ b/spec/requests/api/ci/runner/jobs_put_spec.rb
@@ -78,6 +78,33 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
end
end
+ context 'when an exit_code is provided' do
+ context 'when the exit_codes are acceptable' do
+ before do
+ job.options[:allow_failure_criteria] = { exit_codes: [1] }
+ job.save!
+ end
+
+ it 'accepts an exit code' do
+ update_job(state: 'failed', exit_code: 1)
+
+ expect(job.reload).to be_failed
+ expect(job.allow_failure).to be_truthy
+ expect(job).to be_unknown_failure
+ end
+ end
+
+ context 'when the exit_codes are not defined' do
+ it 'ignore the exit code' do
+ update_job(state: 'failed', exit_code: 1)
+
+ expect(job.reload).to be_failed
+ expect(job.allow_failure).to be_falsy
+ expect(job).to be_unknown_failure
+ end
+ end
+ end
+
context 'when failure_reason is script_failure' do
before do
update_job(state: 'failed', failure_reason: 'script_failure')