Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
48f37a92
Commit
48f37a92
authored
Sep 20, 2018
by
Markus Doits
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a test that checks that retry when values in documentation are valid
parent
95236f53
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+8
-0
spec/lib/gitlab/ci/config/entry/job_spec.rb
spec/lib/gitlab/ci/config/entry/job_spec.rb
+27
-1
No files found.
doc/ci/yaml/README.md
View file @
48f37a92
...
@@ -1484,6 +1484,14 @@ test:
...
@@ -1484,6 +1484,14 @@ test:
Possible values for
`when`
are:
Possible values for
`when`
are:
<!--
Please make sure to update
`RETRY_WHEN_IN_DOCUMENTATION`
array in
`spec/lib/gitlab/ci/config/entry/job_spec.rb`
if you change any of
the documented values below. The test there makes sure that all documented
values are really valid as a config option and therefore should always
stay in sync with this documentation.
-->
-
`always`
: retry on any failure (default)
-
`always`
: retry on any failure (default)
-
`unknown_failure`
: retry when the failure reason is unknown
-
`unknown_failure`
: retry when the failure reason is unknown
-
`script_failure`
: retry when the script failed
-
`script_failure`
: retry when the script failed
...
...
spec/lib/gitlab/ci/config/entry/job_spec.rb
View file @
48f37a92
...
@@ -138,6 +138,32 @@ describe Gitlab::Ci::Config::Entry::Job do
...
@@ -138,6 +138,32 @@ describe Gitlab::Ci::Config::Entry::Job do
expect
(
entry
).
to
be_valid
expect
(
entry
).
to
be_valid
end
end
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
end
context
'when retry value is not correct'
do
context
'when retry value is not correct'
do
...
@@ -181,7 +207,7 @@ describe Gitlab::Ci::Config::Entry::Job do
...
@@ -181,7 +207,7 @@ describe Gitlab::Ci::Config::Entry::Job do
end
end
context
'defined as a hash'
do
context
'defined as a hash'
do
context
'with unkown keys'
do
context
'with unk
n
own keys'
do
let
(
:config
)
{
{
retry:
{
max:
2
,
unknown_key: :something
,
one_more: :key
}
}
}
let
(
:config
)
{
{
retry:
{
max:
2
,
unknown_key: :something
,
one_more: :key
}
}
}
it
'returns error about the unknown key'
do
it
'returns error about the unknown key'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment