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
658c5f32
Commit
658c5f32
authored
Feb 15, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for cloning attributes when retrying a build
parent
7e8a3f7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
spec/services/ci/retry_build_service_spec.rb
spec/services/ci/retry_build_service_spec.rb
+32
-0
No files found.
spec/services/ci/retry_build_service_spec.rb
View file @
658c5f32
...
...
@@ -10,6 +10,34 @@ describe Ci::RetryBuildService, :services do
described_class
.
new
(
project
,
user
)
end
shared_examples
'build duplication'
do
let
(
:build
)
do
create
(
:ci_build
,
:failed
,
:artifacts
,
pipeline:
pipeline
,
coverage:
90.0
,
coverage_regex:
'/(d+)/'
)
end
it
'clones expected attributes'
do
clone_attributes
=
%w[ref tag project pipeline options commands tag_list
name allow_failure stage stage_idx trigger_request
yaml_variables when environment coverage_regex]
clone_attributes
.
each
do
|
attribute
|
expect
(
new_build
.
send
(
attribute
)).
to
eq
build
.
send
(
attribute
)
end
end
it
'does not clone forbidden attributes'
do
forbidden_attributes
=
%w[id status token user artifacts_file
artifacts_metadata coverage]
forbidden_attributes
.
each
do
|
attribute
|
expect
(
new_build
.
send
(
attribute
)).
not_to
eq
build
.
send
(
attribute
)
end
end
end
describe
'#execute'
do
let
(
:new_build
)
{
service
.
execute
(
build
)
}
...
...
@@ -18,6 +46,8 @@ describe Ci::RetryBuildService, :services do
project
.
add_developer
(
user
)
end
it_behaves_like
'build duplication'
it
'creates a new build that represents the old one'
do
expect
(
new_build
.
name
).
to
eq
build
.
name
end
...
...
@@ -62,6 +92,8 @@ describe Ci::RetryBuildService, :services do
project
.
add_developer
(
user
)
end
it_behaves_like
'build duplication'
it
'creates a new build that represents the old one'
do
expect
(
new_build
.
name
).
to
eq
build
.
name
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