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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
f48261a4
Commit
f48261a4
authored
Nov 06, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor Normalizer specs
parent
4b2b154c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
11 deletions
+3
-11
lib/gitlab/ci/config/normalizer.rb
lib/gitlab/ci/config/normalizer.rb
+1
-1
spec/lib/gitlab/ci/config/normalizer_spec.rb
spec/lib/gitlab/ci/config/normalizer_spec.rb
+2
-10
No files found.
lib/gitlab/ci/config/normalizer.rb
View file @
f48261a4
...
...
@@ -27,7 +27,7 @@ module Gitlab
def
parallelize_jobs
(
jobs_config
,
parallelized_jobs
)
jobs_config
.
each_with_object
({})
do
|
(
job_name
,
config
),
hash
|
if
parallelized_jobs
.
key
s
.
include
?
(
job_name
)
if
parallelized_jobs
.
key?
(
job_name
)
parallelized_jobs
[
job_name
].
each
{
|
name
,
index
|
hash
[
name
.
to_sym
]
=
config
.
merge
(
name:
name
,
instance:
index
)
}
else
hash
[
job_name
]
=
config
...
...
spec/lib/gitlab/ci/config/normalizer_spec.rb
View file @
f48261a4
...
...
@@ -15,7 +15,7 @@ describe Gitlab::Ci::Config::Normalizer do
end
it
'has parallelized jobs'
do
job_names
=
described_class
.
send
(
:parallelize_job_names
,
job_name
,
5
).
map
{
|
job_name
,
index
|
job_name
.
to_sym
}
job_names
=
[
:"rspec 1/5"
,
:"rspec 2/5"
,
:"rspec 3/5"
,
:"rspec 4/5"
,
:"rspec 5/5"
]
is_expected
.
to
include
(
*
job_names
)
end
...
...
@@ -35,18 +35,10 @@ describe Gitlab::Ci::Config::Normalizer do
let
(
:config
)
{
{
job_name
=>
job_config
,
other_job:
{
script:
'echo 1'
,
dependencies:
[
job_name
.
to_s
]
}
}
}
it
'parallelizes dependencies'
do
job_names
=
described_class
.
send
(
:parallelize_job_names
,
job_name
,
5
).
map
(
&
:first
)
job_names
=
[
"rspec 1/5"
,
"rspec 2/5"
,
"rspec 3/5"
,
"rspec 4/5"
,
"rspec 5/5"
]
expect
(
subject
[
:other_job
][
:dependencies
]).
to
include
(
*
job_names
)
end
end
end
describe
'.parallelize_job_names'
do
subject
{
described_class
.
send
(
:parallelize_job_names
,
job_name
,
5
)
}
it
'returns parallelized names'
do
expect
(
subject
.
map
(
&
:first
)).
to
all
(
match
(
%r{
#{
job_name
}
\d
+/
\d
+}
))
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