Commit 584fc5c5 authored by Robert Speicher's avatar Robert Speicher

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
parents 676d558a 22aef3d4
......@@ -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
......
---
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment