Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Doits <markus.doits@stellenticket.de>2018-09-20 17:25:37 +0300
committerMarkus Doits <markus.doits@stellenticket.de>2018-11-07 15:04:03 +0300
commit48f37a92be9b9b3e21cce6772c147a303a881ca5 (patch)
treea9bff3fd9c81663a8a15e83a03e3552436d1fe8d /spec/lib/gitlab/ci/config
parent95236f539a2a1734db24226682965164a3db0a8e (diff)
add a test that checks that retry when values in documentation are valid
Diffstat (limited to 'spec/lib/gitlab/ci/config')
-rw-r--r--spec/lib/gitlab/ci/config/entry/job_spec.rb28
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/job_spec.rb b/spec/lib/gitlab/ci/config/entry/job_spec.rb
index 7d0a5b81084..36ff4519bcb 100644
--- a/spec/lib/gitlab/ci/config/entry/job_spec.rb
+++ b/spec/lib/gitlab/ci/config/entry/job_spec.rb
@@ -138,6 +138,32 @@ describe Gitlab::Ci::Config::Entry::Job do
expect(entry).to be_valid
end
end
+
+ # Those values are documented at `doc/ci/yaml/README.md`. If any of
+ # those values gets invalid, documentation must be updated. To make
+ # sure this is catched, check explicitly that all of the documented
+ # values are valid. If they are not it means the documentation and this
+ # array must be updated.
+ RETRY_WHEN_IN_DOCUMENTATION = %w[
+ always
+ unknown_failure
+ script_failure
+ api_failure
+ stuck_or_timeout_failure
+ runner_system_failure
+ missing_dependency_failure
+ runner_unsupported
+ ].freeze
+
+ RETRY_WHEN_IN_DOCUMENTATION.each do |reason|
+ context "when it is a hash with value from documentation `#{reason}`" do
+ let(:config) { { script: 'rspec', retry: { max: 2, when: reason } } }
+
+ it 'is valid' do
+ expect(entry).to be_valid
+ end
+ end
+ end
end
context 'when retry value is not correct' do
@@ -181,7 +207,7 @@ describe Gitlab::Ci::Config::Entry::Job do
end
context 'defined as a hash' do
- context 'with unkown keys' do
+ context 'with unknown keys' do
let(:config) { { retry: { max: 2, unknown_key: :something, one_more: :key } } }
it 'returns error about the unknown key' do