BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
23 deletions
+22
-23
retry_build_service.rb
app/services/ci/retry_build_service.rb
+1
-13
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
...
...
@@ -3,19 +3,7 @@ module Ci
CLONE_ACCESSORS
=
%i[pipeline project ref tag options commands name
allow_failure stage stage_idx trigger_request
yaml_variables when environment coverage_regex
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
description tag_list]
.
freeze
def
execute
(
build
)
reprocess
(
build
).
tap
do
|
new_build
|
...
...
spec/services/ci/retry_build_service_spec.rb
View file @
c3d24d0b
...
...
@@ -10,6 +10,20 @@ describe Ci::RetryBuildService, :services do
described_class
.
new
(
project
,
user
)
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
let
(
:build
)
do
create
(
:ci_build
,
:failed
,
:artifacts_expired
,
:erased
,
...
...
@@ -18,8 +32,8 @@ describe Ci::RetryBuildService, :services do
description:
'some build'
,
pipeline:
pipeline
)
end
describe
'clone a
ttribute
s'
do
described_class
::
CLONE_ACCESSORS
.
each
do
|
attribute
|
describe
'clone a
ccessor
s'
do
CLONE_ACCESSORS
.
each
do
|
attribute
|
it
"clones
#{
attribute
}
build attribute"
do
expect
(
new_build
.
send
(
attribute
)).
to
be_present
expect
(
new_build
.
send
(
attribute
)).
to
eq
build
.
send
(
attribute
)
...
...
@@ -27,8 +41,8 @@ describe Ci::RetryBuildService, :services do
end
end
describe
'reject a
ttribute
s'
do
described_class
::
REJECT_ACCESSORS
.
each
do
|
attribute
|
describe
'reject a
cessor
s'
do
REJECT_ACCESSORS
.
each
do
|
attribute
|
it
"does not clone
#{
attribute
}
build attribute"
do
expect
(
new_build
.
send
(
attribute
)).
not_to
eq
build
.
send
(
attribute
)
end
...
...
@@ -36,18 +50,15 @@ describe Ci::RetryBuildService, :services do
end
it
'has correct number of known attributes'
do
known_accessors
=
described_class
::
CLONE_ACCESSORS
+
described_class
::
IGNORE_ACCESSORS
+
described_class
::
REJECT_ACCESSORS
known_accessors
=
CLONE_ACCESSORS
+
REJECT_ACCESSORS
+
IGNORE_ACCESSORS
# :tag_list is a special case, this accessor does not exist
# in reflected associations, comes from `act_as_taggable` and
# we use it to copy tags, instead of reusing tags.
#
current_accessors
=
build
.
attribute_names
.
map
.
map
(
&
:to_sym
)
+
build
.
_reflections
.
map
{
|
assoc
|
assoc
.
first
.
to_sym
}
+
Ci
::
Build
.
attribute_names
.
map
(
&
:to_sym
)
+
Ci
::
Build
.
reflect_on_all_associations
.
map
(
&
:name
)
+
[
:tag_list
]
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