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
0c4567c0
Commit
0c4567c0
authored
Mar 24, 2020
by
drew cimino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ci::Pipeline factories for the various kind of merge request pipelines
parent
a3788157
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
17 deletions
+29
-17
spec/factories/ci/pipelines.rb
spec/factories/ci/pipelines.rb
+24
-0
spec/factories/merge_requests.rb
spec/factories/merge_requests.rb
+5
-17
No files found.
spec/factories/ci/pipelines.rb
View file @
0c4567c0
...
...
@@ -99,6 +99,30 @@ FactoryBot.define do
trait
:repository_source
do
config_source
{
Ci
::
Pipeline
.
config_sources
[
:repository_source
]
}
end
trait
:detached_merge_request_pipeline
do
merge_request
source
{
:merge_request_event
}
project
{
merge_request
.
source_project
}
sha
{
merge_request
.
source_branch_sha
}
ref
{
merge_request
.
ref_path
}
end
trait
:legacy_detached_merge_request_pipeline
do
detached_merge_request_pipeline
ref
{
merge_request
.
source_branch
}
end
trait
:merged_result_pipeline
do
detached_merge_request_pipeline
sha
{
'test-merge-sha'
}
ref
{
merge_request
.
merge_ref_path
}
source_sha
{
merge_request
.
source_branch_sha
}
target_sha
{
merge_request
.
target_branch_sha
}
end
end
end
end
spec/factories/merge_requests.rb
View file @
0c4567c0
...
...
@@ -147,23 +147,13 @@ FactoryBot.define do
trait
:with_legacy_detached_merge_request_pipeline
do
after
(
:create
)
do
|
merge_request
|
merge_request
.
pipelines_for_merge_request
<<
create
(
:ci_pipeline
,
source: :merge_request_event
,
merge_request:
merge_request
,
project:
merge_request
.
source_project
,
ref:
merge_request
.
source_branch
,
sha:
merge_request
.
source_branch_sha
)
create
(
:ci_pipeline
,
:legacy_detached_merge_request_pipeline
,
merge_request:
merge_request
)
end
end
trait
:with_detached_merge_request_pipeline
do
after
(
:create
)
do
|
merge_request
|
merge_request
.
pipelines_for_merge_request
<<
create
(
:ci_pipeline
,
source: :merge_request_event
,
merge_request:
merge_request
,
project:
merge_request
.
source_project
,
ref:
merge_request
.
ref_path
,
sha:
merge_request
.
source_branch_sha
)
create
(
:ci_pipeline
,
:detached_merge_request_pipeline
,
merge_request:
merge_request
)
end
end
...
...
@@ -175,14 +165,12 @@ FactoryBot.define do
end
after
(
:create
)
do
|
merge_request
,
evaluator
|
merge_request
.
pipelines_for_merge_request
<<
create
(
:ci_pipeline
,
source: :merge_request_event
,
create
(
:ci_pipeline
,
:merged_result_pipeline
,
merge_request:
merge_request
,
project:
merge_request
.
source_project
,
ref:
merge_request
.
merge_ref_path
,
sha:
evaluator
.
merge_sha
,
source_sha:
evaluator
.
source_sha
,
target_sha:
evaluator
.
target_sha
)
target_sha:
evaluator
.
target_sha
)
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