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
dc2fcfe6
Commit
dc2fcfe6
authored
Feb 05, 2019
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add upstream/downstream pipeline specs
parent
4f37462f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
4 deletions
+70
-4
ee/app/serializers/dashboard_operations_project_entity.rb
ee/app/serializers/dashboard_operations_project_entity.rb
+4
-4
ee/spec/serializers/dashboard_operations_project_entity_spec.rb
...c/serializers/dashboard_operations_project_entity_spec.rb
+66
-0
No files found.
ee/app/serializers/dashboard_operations_project_entity.rb
View file @
dc2fcfe6
...
...
@@ -46,6 +46,10 @@ class DashboardOperationsProjectEntity < Grape::Entity
)
end
def
last_pipeline
dashboard_project
.
project
.
commit
&
.
last_pipeline
end
def
upstream_pipeline
last_pipeline
&
.
source_pipeline
&
.
source_pipeline
end
...
...
@@ -54,10 +58,6 @@ class DashboardOperationsProjectEntity < Grape::Entity
last_pipeline
&
.
sourced_pipelines
&
.
map
(
&
:source_pipeline
)
end
def
last_pipeline
dashboard_project
.
project
.
commit
&
.
last_pipeline
end
def
last_deployment?
dashboard_project
.
last_deployment
end
...
...
ee/spec/serializers/dashboard_operations_project_entity_spec.rb
View file @
dc2fcfe6
...
...
@@ -14,4 +14,70 @@ describe DashboardOperationsProjectEntity do
expect
(
subject
).
to
include
(
:remove_path
,
:alert_count
)
expect
(
subject
.
first
).
to
include
(
:id
)
end
it
'does not have optional fields'
do
expect
(
subject
).
not_to
include
(
:last_pipeline
,
:upstream_pipeline
,
:downstream_pipelines
)
end
context
'when there is a pipeline'
do
let!
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
sha
)
}
it
'has the last pipeline field'
do
expect
(
subject
).
to
include
(
:last_pipeline
)
end
context
'when there is an upstream status'
do
let
(
:bridge
)
{
create
(
:ci_bridge
,
status: :pending
)
}
before
do
create
(
:ci_sources_pipeline
,
pipeline:
pipeline
,
source_job:
bridge
)
end
it
'has the upstream pipeline field'
do
expect
(
subject
).
to
include
(
:upstream_pipeline
)
end
end
context
'when there is a downstream status'
do
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
before
do
create
(
:ci_sources_pipeline
,
source_job:
build
)
end
it
'has the downstream pipeline field'
do
expect
(
subject
).
to
include
(
:downstream_pipelines
)
end
context
'when there are multiple downstream statuses'
do
before
do
create_list
(
:ci_sources_pipeline
,
5
,
source_job:
build
)
end
it
'has the downstream pipeline field'
do
expect
(
subject
).
to
include
(
:downstream_pipelines
)
expect
(
subject
[
:downstream_pipelines
].
count
).
to
eq
(
6
)
end
end
end
context
'when there are both an upstream and downstream pipelines'
do
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let
(
:bridge
)
{
create
(
:ci_bridge
,
status: :pending
)
}
before
do
create
(
:ci_sources_pipeline
,
pipeline:
pipeline
,
source_job:
bridge
)
create_list
(
:ci_sources_pipeline
,
5
,
source_job:
build
)
end
it
'has the upstream pipeline field'
do
expect
(
subject
).
to
include
(
:upstream_pipeline
)
end
it
'has the downstream pipeline field'
do
expect
(
subject
).
to
include
(
:downstream_pipelines
)
expect
(
subject
[
:downstream_pipelines
].
count
).
to
eq
(
5
)
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