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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
0c59fdaa
Commit
0c59fdaa
authored
Nov 07, 2018
by
Markus Doits
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix merge conflict
parent
1c807d01
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
356 deletions
+0
-356
spec/lib/gitlab/ci/config/entry/job_spec.rb
spec/lib/gitlab/ci/config/entry/job_spec.rb
+0
-356
No files found.
spec/lib/gitlab/ci/config/entry/job_spec.rb
View file @
0c59fdaa
...
...
@@ -98,183 +98,6 @@ describe Gitlab::Ci::Config::Entry::Job do
end
end
<<<<<<<
HEAD
context
'when retry value is correct'
do
context
'when it is a numeric'
do
let
(
:config
)
{
{
script:
'rspec'
,
retry:
2
}
}
it
'is valid'
do
expect
(
entry
).
to
be_valid
end
end
context
'when it is a hash without when'
do
let
(
:config
)
{
{
script:
'rspec'
,
retry:
{
max:
2
}
}
}
it
'is valid'
do
expect
(
entry
).
to
be_valid
end
end
context
'when it is a hash with string when'
do
let
(
:config
)
{
{
script:
'rspec'
,
retry:
{
max:
2
,
when:
'unknown_failure'
}
}
}
it
'is valid'
do
expect
(
entry
).
to
be_valid
end
end
context
'when it is a hash with string when always'
do
let
(
:config
)
{
{
script:
'rspec'
,
retry:
{
max:
2
,
when:
'always'
}
}
}
it
'is valid'
do
expect
(
entry
).
to
be_valid
end
end
context
'when it is a hash with array when'
do
let
(
:config
)
{
{
script:
'rspec'
,
retry:
{
max:
2
,
when:
%w[unknown_failure runner_system_failure]
}
}
}
it
'is valid'
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
context
'when it is not a numeric nor an array'
do
let
(
:config
)
{
{
retry:
true
}
}
it
'returns error about invalid type'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job retry should be a hash or an integer'
end
end
context
'not defined as a hash'
do
context
'when it is lower than zero'
do
let
(
:config
)
{
{
retry:
-
1
}
}
it
'returns error about value too low'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
)
.
to
include
'job retry max must be greater than or equal to 0'
end
end
context
'when it is not an integer'
do
let
(
:config
)
{
{
retry:
1.5
}
}
it
'returns error about wrong value'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job retry should be a hash or an integer'
end
end
context
'when the value is too high'
do
let
(
:config
)
{
{
retry:
10
}
}
it
'returns error about value too high'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job retry max must be less than or equal to 2'
end
end
end
context
'defined as a hash'
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
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
)
.
to
include
'job retry contains unknown keys: unknown_key, one_more'
end
end
context
'when max is lower than zero'
do
let
(
:config
)
{
{
retry:
{
max:
-
1
}
}
}
it
'returns error about value too low'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
)
.
to
include
'job retry max must be greater than or equal to 0'
end
end
context
'when max is not an integer'
do
let
(
:config
)
{
{
retry:
{
max:
1.5
}
}
}
it
'returns error about wrong value'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job retry max must be an integer'
end
end
context
'when max is too high'
do
let
(
:config
)
{
{
retry:
{
max:
10
}
}
}
it
'returns error about value too high'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job retry max must be less than or equal to 2'
end
end
context
'when when has the wrong format'
do
let
(
:config
)
{
{
retry:
{
when:
true
}
}
}
it
'returns error about the wrong format'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job retry max must be an integer'
end
end
context
'when when is a string and unknown'
do
let
(
:config
)
{
{
retry:
{
when:
'unknown_reason'
}
}
}
it
'returns error about the wrong format'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job retry when is unknown'
end
end
context
'when when is an array and includes unknown failures'
do
let
(
:config
)
{
{
retry:
{
when:
%w[unknown_reason runner_system_failure]
}
}
}
it
'returns error about the wrong format'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job retry when contains unknown values: unknown_reason'
end
end
end
end
context
'when parallel value is not correct'
do
context
'when it is not a numeric value'
do
let
(
:config
)
{
{
parallel:
true
}
}
...
...
@@ -305,185 +128,6 @@ describe Gitlab::Ci::Config::Entry::Job do
end
end
|||||||
merged
common
ancestors
context
'when retry value is correct'
do
context
'when it is a numeric'
do
let
(
:config
)
{
{
script:
'rspec'
,
retry:
2
}
}
it
'is valid'
do
expect
(
entry
).
to
be_valid
end
end
context
'when it is a hash without when'
do
let
(
:config
)
{
{
script:
'rspec'
,
retry:
{
max:
2
}
}
}
it
'is valid'
do
expect
(
entry
).
to
be_valid
end
end
context
'when it is a hash with string when'
do
let
(
:config
)
{
{
script:
'rspec'
,
retry:
{
max:
2
,
when:
'unknown_failure'
}
}
}
it
'is valid'
do
expect
(
entry
).
to
be_valid
end
end
context
'when it is a hash with string when always'
do
let
(
:config
)
{
{
script:
'rspec'
,
retry:
{
max:
2
,
when:
'always'
}
}
}
it
'is valid'
do
expect
(
entry
).
to
be_valid
end
end
context
'when it is a hash with array when'
do
let
(
:config
)
{
{
script:
'rspec'
,
retry:
{
max:
2
,
when:
%w[unknown_failure runner_system_failure]
}
}
}
it
'is valid'
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
context
'when it is not a numeric nor an array'
do
let
(
:config
)
{
{
retry:
true
}
}
it
'returns error about invalid type'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job retry should be a hash or an integer'
end
end
context
'not defined as a hash'
do
context
'when it is lower than zero'
do
let
(
:config
)
{
{
retry:
-
1
}
}
it
'returns error about value too low'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
)
.
to
include
'job retry max must be greater than or equal to 0'
end
end
context
'when it is not an integer'
do
let
(
:config
)
{
{
retry:
1.5
}
}
it
'returns error about wrong value'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job retry should be a hash or an integer'
end
end
context
'when the value is too high'
do
let
(
:config
)
{
{
retry:
10
}
}
it
'returns error about value too high'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job retry max must be less than or equal to 2'
end
end
end
context
'defined as a hash'
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
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
)
.
to
include
'job retry contains unknown keys: unknown_key, one_more'
end
end
context
'when max is lower than zero'
do
let
(
:config
)
{
{
retry:
{
max:
-
1
}
}
}
it
'returns error about value too low'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
)
.
to
include
'job retry max must be greater than or equal to 0'
end
end
context
'when max is not an integer'
do
let
(
:config
)
{
{
retry:
{
max:
1.5
}
}
}
it
'returns error about wrong value'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job retry max must be an integer'
end
end
context
'when max is too high'
do
let
(
:config
)
{
{
retry:
{
max:
10
}
}
}
it
'returns error about value too high'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job retry max must be less than or equal to 2'
end
end
context
'when when has the wrong format'
do
let
(
:config
)
{
{
retry:
{
when:
true
}
}
}
it
'returns error about the wrong format'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job retry max must be an integer'
end
end
context
'when when is a string and unknown'
do
let
(
:config
)
{
{
retry:
{
when:
'unknown_reason'
}
}
}
it
'returns error about the wrong format'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job retry when is unknown'
end
end
context
'when when is an array and includes unknown failures'
do
let
(
:config
)
{
{
retry:
{
when:
%w[unknown_reason runner_system_failure]
}
}
}
it
'returns error about the wrong format'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job retry when contains unknown values: unknown_reason'
end
end
end
end
=======
>>>>>>>
refactor
validations
to
a
Entry
::
Retry
class
context
'when delayed job'
do
context
'when start_in is specified'
do
let
(
:config
)
{
{
script:
'echo'
,
when:
'delayed'
,
start_in:
'1 day'
}
}
...
...
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