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
2ebba1ff
Commit
2ebba1ff
authored
Jul 30, 2018
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve Ci::Status::Build specs
parent
8ce4bf20
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
8 deletions
+39
-8
lib/gitlab/ci/status/build/failed.rb
lib/gitlab/ci/status/build/failed.rb
+12
-8
spec/lib/gitlab/ci/status/build/failed_spec.rb
spec/lib/gitlab/ci/status/build/failed_spec.rb
+27
-0
No files found.
lib/gitlab/ci/status/build/failed.rb
View file @
2ebba1ff
...
...
@@ -4,13 +4,13 @@ module Gitlab
module
Build
class
Failed
<
Status
::
Extended
REASONS
=
{
'unknown_failure'
=>
'unknown failure'
,
'script_failure'
=>
'script failure'
,
'api_failure'
=>
'API failure'
,
'stuck_or_timeout_failure'
=>
'stuck or timeout failure'
,
'runner_system_failure'
=>
'runner system failure'
,
'missing_dependency_failure'
=>
'missing dependency failure'
,
# COMMENTED to check if CI fails: 'runner_unsupported' => 'unsuported runner',
unknown_failure:
'unknown failure'
,
script_failure:
'script failure'
,
api_failure:
'API failure'
,
stuck_or_timeout_failure:
'stuck or timeout failure'
,
runner_system_failure:
'runner system failure'
,
missing_dependency_failure:
'missing dependency failure'
,
runner_unsupported:
'Your runner is outdated, please upgrade your runner'
}.
freeze
def
status_tooltip
...
...
@@ -32,7 +32,11 @@ module Gitlab
end
def
description
"<br> (
#{
REASONS
[
subject
.
failure_reason
]
}
)"
"<br> (
#{
failure_reason_message
}
)"
end
def
failure_reason_message
REASONS
.
fetch
(
subject
.
failure_reason
.
to_sym
)
end
end
end
...
...
spec/lib/gitlab/ci/status/build/failed_spec.rb
View file @
2ebba1ff
...
...
@@ -80,4 +80,31 @@ describe Gitlab::Ci::Status::Build::Failed do
end
end
end
describe
'covers all failure reasons'
do
let
(
:status
)
{
Gitlab
::
Ci
::
Status
::
Failed
.
new
(
build
,
user
)
}
let
(
:tooltip
)
{
subject
.
status_tooltip
}
CommitStatus
.
failure_reasons
.
keys
.
each
do
|
failure_reason
|
context
failure_reason
do
before
do
build
.
failure_reason
=
failure_reason
end
it
"is a valid status"
do
expect
{
tooltip
}.
not_to
raise_error
end
end
end
context
'invalid failure message'
do
before
do
expect
(
build
).
to
receive
(
:failure_reason
)
{
'invalid failure message'
}
end
it
"is an invalid status"
do
expect
{
tooltip
}.
to
raise_error
(
/key not found:/
)
end
end
end
end
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