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
5e3cfe2f
Commit
5e3cfe2f
authored
Dec 05, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose pipeline detailed status using status factory
parent
b2ab11a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
0 deletions
+74
-0
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+4
-0
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+70
-0
No files found.
app/models/ci/pipeline.rb
View file @
5e3cfe2f
...
...
@@ -320,6 +320,10 @@ module Ci
.
select
{
|
merge_request
|
merge_request
.
head_pipeline
.
try
(
:id
)
==
self
.
id
}
end
def
detailed_status
Gitlab
::
Ci
::
Status
::
Pipeline
::
Factory
.
new
(
self
).
fabricate!
end
private
def
pipeline_data
...
...
spec/models/ci/pipeline_spec.rb
View file @
5e3cfe2f
...
...
@@ -404,6 +404,76 @@ describe Ci::Pipeline, models: true do
end
end
describe
'#detailed_status'
do
context
'when pipeline is created'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
status: :created
)
}
it
'returns detailed status for created pipeline'
do
expect
(
pipeline
.
detailed_status
.
text
).
to
eq
'created'
end
end
context
'when pipeline is pending'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
status: :pending
)
}
it
'returns detailed status for pending pipeline'
do
expect
(
pipeline
.
detailed_status
.
text
).
to
eq
'pending'
end
end
context
'when pipeline is running'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
status: :running
)
}
it
'returns detailed status for running pipeline'
do
expect
(
pipeline
.
detailed_status
.
text
).
to
eq
'running'
end
end
context
'when pipeline is successful'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
status: :success
)
}
it
'returns detailed status for successful pipeline'
do
expect
(
pipeline
.
detailed_status
.
text
).
to
eq
'passed'
end
end
context
'when pipeline is failed'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
status: :failed
)
}
it
'returns detailed status for failed pipeline'
do
expect
(
pipeline
.
detailed_status
.
text
).
to
eq
'failed'
end
end
context
'when pipeline is canceled'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
status: :canceled
)
}
it
'returns detailed status for canceled pipeline'
do
expect
(
pipeline
.
detailed_status
.
text
).
to
eq
'canceled'
end
end
context
'when pipeline is skipped'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
status: :skipped
)
}
it
'returns detailed status for skipped pipeline'
do
expect
(
pipeline
.
detailed_status
.
text
).
to
eq
'skipped'
end
end
context
'when pipeline is successful but with warnings'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
status: :success
)
}
before
do
create
(
:ci_build
,
:allowed_to_fail
,
:failed
,
pipeline:
pipeline
)
end
it
'retruns detailed status for successful pipeline with warnings'
do
expect
(
pipeline
.
detailed_status
.
label
).
to
eq
'passed with warnings'
end
end
end
describe
'#cancelable?'
do
%i[created running pending]
.
each
do
|
status0
|
context
"when there is a build
#{
status0
}
"
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