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
c7d424f0
Commit
c7d424f0
authored
Jan 22, 2019
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more tests for processing cross-project pipelines
parent
0bb86583
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
ee/spec/services/ci/process_pipeline_service_spec.rb
ee/spec/services/ci/process_pipeline_service_spec.rb
+65
-0
No files found.
ee/spec/services/ci/process_pipeline_service_spec.rb
0 → 100644
View file @
c7d424f0
require
'spec_helper'
describe
Ci
::
ProcessPipelineService
,
'#execute'
do
set
(
:user
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
,
:repository
)
}
set
(
:downstream
)
{
create
(
:project
,
:repository
)
}
set
(
:pipeline
)
do
create
(
:ci_empty_pipeline
,
ref:
'master'
,
project:
project
,
user:
user
)
end
before
do
project
.
add_maintainer
(
user
)
downstream
.
add_developer
(
user
)
end
describe
'cross-project pipelines'
do
before
do
create_processable
(
:ci_build
,
name:
'test'
,
stage:
'test'
)
create_processable
(
:ci_bridge
,
name:
'cross'
,
stage:
'build'
,
downstream:
downstream
)
create_processable
(
:ci_build
,
name:
'deploy'
,
stage:
'deploy'
)
stub_ci_pipeline_to_return_yaml_file
end
it
'creates a downstream cross-project pipeline'
do
pipeline
.
process!
expect_statuses
(
%w[test pending]
,
%w[cross created]
,
%w[deploy created]
)
update_build_status
(
:test
,
:success
)
expect_statuses
(
%w[test success]
,
%w[cross success]
,
%w[deploy pending]
)
expect
(
downstream
.
ci_pipelines
).
to
be_one
expect
(
downstream
.
ci_pipelines
.
first
).
to
be_pending
end
end
def
expect_statuses
(
*
statuses
)
statuses
.
each
do
|
name
,
status
|
pipeline
.
statuses
.
find_by
(
name:
name
).
yield_self
do
|
build
|
expect
(
build
.
status
).
to
eq
status
end
end
end
def
update_build_status
(
name
,
status
)
pipeline
.
builds
.
find_by
(
name:
name
).
public_send
(
status
)
end
def
create_processable
(
type
,
name
:,
**
opts
)
stages
=
%w[test build deploy]
index
=
stages
.
index
(
opts
.
fetch
(
:stage
,
'test'
))
create
(
type
,
status: :created
,
name:
name
,
pipeline:
pipeline
,
stage_idx:
index
,
user:
user
,
**
opts
)
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