Commit cb72d9ef authored by Alessio Caiazza's avatar Alessio Caiazza Committed by Stan Hu

Add packages_size to ProjectStatistics

This new field will allow to keep track of the storage used by the
packages features, it provides also aggregation at namespace level.
parent b12c19d3
......@@ -2463,6 +2463,7 @@ ActiveRecord::Schema.define(version: 20190426180107) do
t.bigint "packages_size"
t.bigint "shared_runners_seconds", default: 0, null: false
t.datetime "shared_runners_seconds_last_reset"
t.bigint "packages_size"
t.index ["namespace_id"], name: "index_project_statistics_on_namespace_id", using: :btree
t.index ["project_id"], name: "index_project_statistics_on_project_id", unique: true, using: :btree
end
......
......@@ -124,7 +124,7 @@ describe ProjectStatistics do
end
describe '.increment_statistic' do
shared_examples 'a statistic that increases storage_size' do
shared_examples 'a statistic that also increases storage_size' do
it 'increases the statistic by that amount' do
expect { described_class.increment_statistic(project.id, stat, 13) }
.to change { statistics.reload.send(stat) || 0 }
......@@ -153,7 +153,7 @@ describe ProjectStatistics do
context 'when the amount is 0' do
it 'does not execute a query' do
project
expect { described_class.increment_statistic(project.id, :build_artifacts_size, 0) }
expect { described_class.increment_statistic(project.id, stat, 0) }
.not_to exceed_query_limit(0)
end
end
......
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