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
48b0bc33
Commit
48b0bc33
authored
Jan 25, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs for retry build after making stages unique
parent
4e4ee368
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
17 deletions
+21
-17
app/services/ci/retry_build_service.rb
app/services/ci/retry_build_service.rb
+1
-1
spec/services/ci/retry_build_service_spec.rb
spec/services/ci/retry_build_service_spec.rb
+20
-16
No files found.
app/services/ci/retry_build_service.rb
View file @
48b0bc33
module
Ci
class
RetryBuildService
<
::
BaseService
CLONE_ACCESSORS
=
%i[pipeline project ref tag options commands name
allow_failure stage
_id stage
stage_idx trigger_request
allow_failure stage
stage_id
stage_idx trigger_request
yaml_variables when environment coverage_regex
description tag_list protected]
.
freeze
...
...
spec/services/ci/retry_build_service_spec.rb
View file @
48b0bc33
...
...
@@ -5,7 +5,11 @@ describe Ci::RetryBuildService do
set
(
:project
)
{
create
(
:project
)
}
set
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let
(
:stage
)
do
Ci
::
Stage
.
create!
(
project:
project
,
pipeline:
pipeline
,
name:
'test'
)
end
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
stage_id:
stage
.
id
)
}
let
(
:service
)
do
described_class
.
new
(
project
,
user
)
...
...
@@ -26,29 +30,27 @@ describe Ci::RetryBuildService do
user_id auto_canceled_by_id retried failure_reason]
.
freeze
shared_examples
'build duplication'
do
let
(
:stage
)
do
# TODO, we still do not have factory for new stages, we will need to
# switch existing factory to persist stages, instead of using LegacyStage
#
Ci
::
Stage
.
create!
(
project:
project
,
pipeline:
pipeline
,
name:
'test'
)
end
let
(
:another_pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
)
}
let
(
:build
)
do
create
(
:ci_build
,
:failed
,
:artifacts
,
:expired
,
:erased
,
:queued
,
:coverage
,
:tags
,
:allowed_to_fail
,
:on_tag
,
:triggered
,
:trace
,
:teardown_environment
,
description:
'my-job'
,
stage:
'test'
,
pipeline:
pipeline
,
auto_canceled_by:
create
(
:ci_empty_pipeline
,
project:
project
))
do
|
build
|
##
# TODO, workaround for FactoryBot limitation when having both
# stage (text) and stage_id (integer) columns in the table.
build
.
stage_id
=
stage
.
id
description:
'my-job'
,
stage:
'test'
,
stage_id:
stage
.
id
,
pipeline:
pipeline
,
auto_canceled_by:
another_pipeline
)
end
before
do
# Make sure that build has both `stage_id` and `stage` because FactoryBot
# can reset one of the fields when assigning another. We plan to deprecate
# and remove legacy `stage` column in the future.
build
.
update_attributes
(
stage:
'test'
,
stage_id:
stage
.
id
)
end
describe
'clone accessors'
do
CLONE_ACCESSORS
.
each
do
|
attribute
|
it
"clones
#{
attribute
}
build attribute"
do
expect
(
build
.
send
(
attribute
)).
not_to
be_nil
expect
(
new_build
.
send
(
attribute
)).
not_to
be_nil
expect
(
new_build
.
send
(
attribute
)).
to
eq
build
.
send
(
attribute
)
end
...
...
@@ -121,10 +123,12 @@ describe Ci::RetryBuildService do
context
'when there are subsequent builds that are skipped'
do
let!
(
:subsequent_build
)
do
create
(
:ci_build
,
:skipped
,
stage_idx:
1
,
pipeline:
pipeline
)
create
(
:ci_build
,
:skipped
,
stage_idx:
2
,
pipeline:
pipeline
,
stage:
'deploy'
)
end
it
'resumes pipeline processing in
subsequent stages
'
do
it
'resumes pipeline processing in
a subsequent stage
'
do
service
.
execute
(
build
)
expect
(
subsequent_build
.
reload
).
to
be_created
...
...
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