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
Léo-Paul Géneau
gitlab-ce
Commits
03bc722e
Commit
03bc722e
authored
Oct 27, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Build seed specs
parent
a12da215
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
3 deletions
+56
-3
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
+56
-3
No files found.
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
View file @
03bc722e
...
...
@@ -13,6 +13,46 @@ describe Gitlab::Ci::Pipeline::Seed::Build do
described_class
.
new
(
pipeline
,
attributes
)
end
describe
'#parallel?'
do
context
'when build is not parallelized'
do
it
'should be false'
do
expect
(
subject
.
parallel?
).
to
eq
(
false
)
end
end
context
'when build is parallelized'
do
before
do
attributes
[
:options
]
=
{
parallel:
5
}
end
it
'should be true'
do
expect
(
subject
.
parallel?
).
to
eq
(
true
)
end
end
end
describe
'#parallelize_build'
do
let
(
:total
)
{
5
}
before
do
attributes
[
:options
]
=
{
parallel:
total
}
end
it
'returns duplicated builds'
do
builds
=
subject
.
parallelize_build
expect
(
builds
.
size
).
to
eq
(
total
)
end
it
'returns builds with indexed names'
do
builds
=
subject
.
parallelize_build
base_name
=
builds
.
first
.
name
.
split
(
' '
)[
0
]
names
=
builds
.
map
(
&
:name
)
expect
(
names
).
to
all
(
match
(
%r{^
#{
base_name
}
\d
+/
\d
+$}
))
end
end
describe
'#attributes'
do
it
'returns hash attributes of a build'
do
expect
(
subject
.
attributes
).
to
be_a
Hash
...
...
@@ -22,10 +62,23 @@ describe Gitlab::Ci::Pipeline::Seed::Build do
end
describe
'#to_resource'
do
context
'when build is not parallelized'
do
it
'returns a valid build resource'
do
expect
(
subject
.
to_resource
).
to
be_a
(
::
Ci
::
Build
)
expect
(
subject
.
to_resource
).
to
be_valid
end
end
context
'when build is parallelized'
do
before
do
attributes
[
:options
]
=
{
parallel:
5
}
end
it
'returns a group of valid build resources'
do
expect
(
subject
.
to_resource
).
to
all
(
be_a
(
::
Ci
::
Build
))
expect
(
subject
.
to_resource
).
to
all
(
be_valid
)
end
end
it
'memoizes a resource object'
do
build
=
subject
.
to_resource
...
...
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