Merge branch '42154-fix-artifact-size-calc' into 'master'
Resolve "Bug calculating artifacts size for project statistics" Closes #42154 See merge request gitlab-org/gitlab-ce!16539
This commit is contained in:
commit
584fc5c5a7
|
@ -37,7 +37,7 @@ class ProjectStatistics < ActiveRecord::Base
|
|||
def update_build_artifacts_size
|
||||
self.build_artifacts_size =
|
||||
project.builds.sum(:artifacts_size) +
|
||||
Ci::JobArtifact.artifacts_size_for(self)
|
||||
Ci::JobArtifact.artifacts_size_for(self.project)
|
||||
end
|
||||
|
||||
def update_storage_size
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Fix a bug calculating artifact size for project statistics
|
||||
merge_request: 16539
|
||||
author:
|
||||
type: fixed
|
|
@ -146,6 +146,12 @@ describe ProjectStatistics do
|
|||
|
||||
expect(statistics.build_artifacts_size).to be(106365)
|
||||
end
|
||||
|
||||
it 'calculates related build artifacts by project' do
|
||||
expect(Ci::JobArtifact).to receive(:artifacts_size_for).with(project) { 0 }
|
||||
|
||||
statistics.update_build_artifacts_size
|
||||
end
|
||||
end
|
||||
|
||||
context 'when legacy artifacts are used' do
|
||||
|
|
Loading…
Reference in New Issue