diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/lib/gitlab/ci/config/entry/job_spec.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) | |
download | gitlab-ce-8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca.tar.gz |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/lib/gitlab/ci/config/entry/job_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/job_spec.rb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/job_spec.rb b/spec/lib/gitlab/ci/config/entry/job_spec.rb index e0e8bc93770..7834a1a94f2 100644 --- a/spec/lib/gitlab/ci/config/entry/job_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/job_spec.rb @@ -670,6 +670,10 @@ RSpec.describe Gitlab::Ci::Config::Entry::Job do end describe '#ignored?' do + before do + entry.compose! + end + context 'when job is a manual action' do context 'when it is not specified if job is allowed to fail' do let(:config) do @@ -700,6 +704,16 @@ RSpec.describe Gitlab::Ci::Config::Entry::Job do expect(entry).not_to be_ignored end end + + context 'when job is dynamically allowed to fail' do + let(:config) do + { script: 'deploy', when: 'manual', allow_failure: { exit_codes: 42 } } + end + + it 'is not an ignored job' do + expect(entry).not_to be_ignored + end + end end context 'when job is not a manual action' do @@ -709,6 +723,10 @@ RSpec.describe Gitlab::Ci::Config::Entry::Job do it 'is not an ignored job' do expect(entry).not_to be_ignored end + + it 'does not return allow_failure' do + expect(entry.value.key?(:allow_failure_criteria)).to be_falsey + end end context 'when job is allowed to fail' do @@ -717,6 +735,10 @@ RSpec.describe Gitlab::Ci::Config::Entry::Job do it 'is an ignored job' do expect(entry).to be_ignored end + + it 'does not return allow_failure_criteria' do + expect(entry.value.key?(:allow_failure_criteria)).to be_falsey + end end context 'when job is not allowed to fail' do @@ -725,6 +747,32 @@ RSpec.describe Gitlab::Ci::Config::Entry::Job do it 'is not an ignored job' do expect(entry).not_to be_ignored end + + it 'does not return allow_failure_criteria' do + expect(entry.value.key?(:allow_failure_criteria)).to be_falsey + end + end + + context 'when job is dynamically allowed to fail' do + let(:config) { { script: 'deploy', allow_failure: { exit_codes: 42 } } } + + it 'is not an ignored job' do + expect(entry).not_to be_ignored + end + + it 'returns allow_failure_criteria' do + expect(entry.value[:allow_failure_criteria]).to match(exit_codes: [42]) + end + + context 'with ci_allow_failure_with_exit_codes disabled' do + before do + stub_feature_flags(ci_allow_failure_with_exit_codes: false) + end + + it 'does not return allow_failure_criteria' do + expect(entry.value.key?(:allow_failure_criteria)).to be_falsey + end + end end end end |