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
d7e2a7f6
Commit
d7e2a7f6
authored
Dec 06, 2019
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preload job_artifacts_archive when loading builds
parent
a1517120
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
app/presenters/ci/legacy_stage_presenter.rb
app/presenters/ci/legacy_stage_presenter.rb
+2
-1
spec/presenters/ci/legacy_stage_presenter_spec.rb
spec/presenters/ci/legacy_stage_presenter_spec.rb
+18
-2
No files found.
app/presenters/ci/legacy_stage_presenter.rb
View file @
d7e2a7f6
...
...
@@ -15,9 +15,10 @@ module Ci
private
def
preload_statuses
(
statuses
)
loaded_statuses
=
statuses
.
load
statuses
.
tap
do
|
statuses
|
# rubocop: disable CodeReuse/ActiveRecord
ActiveRecord
::
Associations
::
Preloader
.
new
.
preload
(
preloadable_statuses
(
statuses
),
:tags
)
ActiveRecord
::
Associations
::
Preloader
.
new
.
preload
(
preloadable_statuses
(
loaded_statuses
),
%w[tags job_artifacts_archive metadata]
)
# rubocop: enable CodeReuse/ActiveRecord
end
end
...
...
spec/presenters/ci/legacy_stage_presenter_spec.rb
View file @
d7e2a7f6
...
...
@@ -6,8 +6,8 @@ describe Ci::LegacyStagePresenter do
let
(
:legacy_stage
)
{
create
(
:ci_stage
)
}
let
(
:presenter
)
{
described_class
.
new
(
legacy_stage
)
}
let!
(
:build
)
{
create
(
:ci_build
,
:tags
,
pipeline:
legacy_stage
.
pipeline
,
stage:
legacy_stage
.
name
)
}
let!
(
:retried_build
)
{
create
(
:ci_build
,
:tags
,
:retried
,
pipeline:
legacy_stage
.
pipeline
,
stage:
legacy_stage
.
name
)
}
let!
(
:build
)
{
create
(
:ci_build
,
:tags
,
:artifacts
,
pipeline:
legacy_stage
.
pipeline
,
stage:
legacy_stage
.
name
)
}
let!
(
:retried_build
)
{
create
(
:ci_build
,
:tags
,
:
artifacts
,
:
retried
,
pipeline:
legacy_stage
.
pipeline
,
stage:
legacy_stage
.
name
)
}
before
do
create
(
:generic_commit_status
,
pipeline:
legacy_stage
.
pipeline
,
stage:
legacy_stage
.
name
)
...
...
@@ -19,6 +19,14 @@ describe Ci::LegacyStagePresenter do
it
'preloads build tags'
do
expect
(
latest_ordered_statuses
.
second
.
association
(
:tags
)).
to
be_loaded
end
it
'preloads build artifacts archive'
do
expect
(
latest_ordered_statuses
.
second
.
association
(
:job_artifacts_archive
)).
to
be_loaded
end
it
'preloads build artifacts metadata'
do
expect
(
latest_ordered_statuses
.
second
.
association
(
:metadata
)).
to
be_loaded
end
end
describe
'#retried_ordered_statuses'
do
...
...
@@ -27,5 +35,13 @@ describe Ci::LegacyStagePresenter do
it
'preloads build tags'
do
expect
(
retried_ordered_statuses
.
first
.
association
(
:tags
)).
to
be_loaded
end
it
'preloads build artifacts archive'
do
expect
(
retried_ordered_statuses
.
first
.
association
(
:job_artifacts_archive
)).
to
be_loaded
end
it
'preloads build artifacts metadata'
do
expect
(
retried_ordered_statuses
.
first
.
association
(
:metadata
)).
to
be_loaded
end
end
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