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
c3d24d0b
Commit
c3d24d0b
authored
Mar 02, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move unused consts from retry build service to specs
parent
6f843457
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
23 deletions
+22
-23
app/services/ci/retry_build_service.rb
app/services/ci/retry_build_service.rb
+1
-13
spec/services/ci/retry_build_service_spec.rb
spec/services/ci/retry_build_service_spec.rb
+21
-10
No files found.
app/services/ci/retry_build_service.rb
View file @
c3d24d0b
...
@@ -5,18 +5,6 @@ module Ci
...
@@ -5,18 +5,6 @@ module Ci
yaml_variables when environment coverage_regex
yaml_variables when environment coverage_regex
description tag_list]
.
freeze
description tag_list]
.
freeze
REJECT_ACCESSORS
=
%i[id status user token coverage trace runner
artifacts_expire_at artifacts_file
artifacts_metadata artifacts_size
created_at updated_at started_at finished_at
queued_at erased_by erased_at]
.
freeze
IGNORE_ACCESSORS
=
%i[type lock_version target_url gl_project_id
deploy job_id base_tags commit_id deployments
erased_by_id last_deployment project_id runner_id
tag_taggings taggings tags trigger_request_id
user_id]
.
freeze
def
execute
(
build
)
def
execute
(
build
)
reprocess
(
build
).
tap
do
|
new_build
|
reprocess
(
build
).
tap
do
|
new_build
|
build
.
pipeline
.
mark_as_processable_after_stage
(
build
.
stage_idx
)
build
.
pipeline
.
mark_as_processable_after_stage
(
build
.
stage_idx
)
...
...
spec/services/ci/retry_build_service_spec.rb
View file @
c3d24d0b
...
@@ -10,6 +10,20 @@ describe Ci::RetryBuildService, :services do
...
@@ -10,6 +10,20 @@ describe Ci::RetryBuildService, :services do
described_class
.
new
(
project
,
user
)
described_class
.
new
(
project
,
user
)
end
end
CLONE_ACCESSORS
=
described_class
::
CLONE_ACCESSORS
REJECT_ACCESSORS
=
%i[id status user token coverage trace runner artifacts_expire_at
artifacts_file artifacts_metadata artifacts_size created_at
updated_at started_at finished_at queued_at erased_by
erased_at]
.
freeze
IGNORE_ACCESSORS
=
%i[type lock_version target_url gl_project_id deploy job_id base_tags
commit_id deployments erased_by_id last_deployment project_id
runner_id tag_taggings taggings tags trigger_request_id
user_id]
.
freeze
shared_examples
'build duplication'
do
shared_examples
'build duplication'
do
let
(
:build
)
do
let
(
:build
)
do
create
(
:ci_build
,
:failed
,
:artifacts_expired
,
:erased
,
create
(
:ci_build
,
:failed
,
:artifacts_expired
,
:erased
,
...
@@ -18,8 +32,8 @@ describe Ci::RetryBuildService, :services do
...
@@ -18,8 +32,8 @@ describe Ci::RetryBuildService, :services do
description:
'some build'
,
pipeline:
pipeline
)
description:
'some build'
,
pipeline:
pipeline
)
end
end
describe
'clone a
ttribute
s'
do
describe
'clone a
ccessor
s'
do
described_class
::
CLONE_ACCESSORS
.
each
do
|
attribute
|
CLONE_ACCESSORS
.
each
do
|
attribute
|
it
"clones
#{
attribute
}
build attribute"
do
it
"clones
#{
attribute
}
build attribute"
do
expect
(
new_build
.
send
(
attribute
)).
to
be_present
expect
(
new_build
.
send
(
attribute
)).
to
be_present
expect
(
new_build
.
send
(
attribute
)).
to
eq
build
.
send
(
attribute
)
expect
(
new_build
.
send
(
attribute
)).
to
eq
build
.
send
(
attribute
)
...
@@ -27,8 +41,8 @@ describe Ci::RetryBuildService, :services do
...
@@ -27,8 +41,8 @@ describe Ci::RetryBuildService, :services do
end
end
end
end
describe
'reject a
ttribute
s'
do
describe
'reject a
cessor
s'
do
described_class
::
REJECT_ACCESSORS
.
each
do
|
attribute
|
REJECT_ACCESSORS
.
each
do
|
attribute
|
it
"does not clone
#{
attribute
}
build attribute"
do
it
"does not clone
#{
attribute
}
build attribute"
do
expect
(
new_build
.
send
(
attribute
)).
not_to
eq
build
.
send
(
attribute
)
expect
(
new_build
.
send
(
attribute
)).
not_to
eq
build
.
send
(
attribute
)
end
end
...
@@ -36,18 +50,15 @@ describe Ci::RetryBuildService, :services do
...
@@ -36,18 +50,15 @@ describe Ci::RetryBuildService, :services do
end
end
it
'has correct number of known attributes'
do
it
'has correct number of known attributes'
do
known_accessors
=
known_accessors
=
CLONE_ACCESSORS
+
REJECT_ACCESSORS
+
IGNORE_ACCESSORS
described_class
::
CLONE_ACCESSORS
+
described_class
::
IGNORE_ACCESSORS
+
described_class
::
REJECT_ACCESSORS
# :tag_list is a special case, this accessor does not exist
# :tag_list is a special case, this accessor does not exist
# in reflected associations, comes from `act_as_taggable` and
# in reflected associations, comes from `act_as_taggable` and
# we use it to copy tags, instead of reusing tags.
# we use it to copy tags, instead of reusing tags.
#
#
current_accessors
=
current_accessors
=
build
.
attribute_names
.
map
.
map
(
&
:to_sym
)
+
Ci
::
Build
.
attribute_names
.
map
(
&
:to_sym
)
+
build
.
_reflections
.
map
{
|
assoc
|
assoc
.
first
.
to_sym
}
+
Ci
::
Build
.
reflect_on_all_associations
.
map
(
&
:name
)
+
[
:tag_list
]
[
:tag_list
]
current_accessors
.
uniq!
current_accessors
.
uniq!
...
...
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