diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-06 12:01:33 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-06 12:01:33 +0100 |
commit | 66dd20966166695695079958d36527606425cb88 (patch) | |
tree | 72a8f5476561b9db8169457954a95fd02cb7c648 /spec/lib/ci | |
parent | 3788f5face7660c43374d85a4fdbeca04e7b8d68 (diff) | |
download | gitlab-ce-66dd20966166695695079958d36527606425cb88.tar.gz |
Ignore job by default if it is a manual action
This makes it possible to maintain backwards compatibility with configs
created when manual actions were non-blocking.
From now manual actions are blocking if configured with `allow_failure:
false`, otherwise manual actions are optional, and their status is
ignored.
Diffstat (limited to 'spec/lib/ci')
-rw-r--r-- | spec/lib/ci/gitlab_ci_yaml_processor_spec.rb | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb index 7145f0da1d3..53abc056602 100644 --- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb +++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb @@ -15,9 +15,9 @@ module Ci end describe '#build_attributes' do - describe 'coverage entry' do - subject { described_class.new(config, path).build_attributes(:rspec) } + subject { described_class.new(config, path).build_attributes(:rspec) } + describe 'coverage entry' do describe 'code coverage regexp' do let(:config) do YAML.dump(rspec: { script: 'rspec', @@ -30,6 +30,56 @@ module Ci end end end + + describe 'allow failure entry' do + context 'when job is a manual action' do + context 'when allow_failure is defined' do + let(:config) do + YAML.dump(rspec: { script: 'rspec', + when: 'manual', + allow_failure: false }) + end + + it 'is not allowed to fail' do + expect(subject[:allow_failure]).to be false + end + end + + context 'when allow_failure is not defined' do + let(:config) do + YAML.dump(rspec: { script: 'rspec', + when: 'manual' }) + end + + it 'is allowed to fail' do + expect(subject[:allow_failure]).to be true + end + end + end + + context 'when job is not a manual action' do + context 'when allow_failure is defined' do + let(:config) do + YAML.dump(rspec: { script: 'rspec', + allow_failure: false }) + end + + it 'is not allowed to fail' do + expect(subject[:allow_failure]).to be false + end + end + + context 'when allow_failure is not defined' do + let(:config) do + YAML.dump(rspec: { script: 'rspec' }) + end + + it 'is not allowed to fail' do + expect(subject[:allow_failure]).to be false + end + end + end + end end describe "#builds_for_ref" do |