diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2019-07-02 14:44:39 +0000 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2019-07-02 14:44:39 +0000 |
commit | dfdfa913ba9cb74beb7adad0352c5efadec84494 (patch) | |
tree | 16d730e52e00d6f921087ec6531ab463447d09f8 /spec/factories/project_statistics.rb | |
parent | e07ebe66af957c46e7c69329b3ab561bb539351b (diff) | |
download | gitlab-ce-dfdfa913ba9cb74beb7adad0352c5efadec84494.tar.gz |
Includes logic to persist namespace statistics
- Add two new ActiveRecord models:
- RootNamespaceStoragestatistics will persist root namespace statistics
- NamespaceAggregationSchedule will save information when a new update
to the namespace statistics needs to be scheduled
- Inject into UpdateProjectStatistics concern a new callback that will
call an async job to insert a new row onto NamespaceAggregationSchedule
table
- When a new row is inserted a new job is scheduled. This job will
update call an specific service to update the statistics and after that
it will delete thee aggregated scheduled row
- The RefresherServices makes heavy use of arel to build composable
queries to update Namespace::RootStorageStatistics attributes.
- Add an extra worker to traverse pending rows on
NAmespace::AggregationSchedule table and schedule a worker for each one
of this rows.
- Add an extra worker to traverse pending rows on
NAmespace::AggregationSchedule table and schedule a worker for each one
of this rows
Diffstat (limited to 'spec/factories/project_statistics.rb')
-rw-r--r-- | spec/factories/project_statistics.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/factories/project_statistics.rb b/spec/factories/project_statistics.rb index 2d0f698475d..3d4174eb852 100644 --- a/spec/factories/project_statistics.rb +++ b/spec/factories/project_statistics.rb @@ -6,5 +6,20 @@ FactoryBot.define do # statistics are automatically created when a project is created project&.statistics || new end + + transient do + with_data { false } + size_multiplier { 1 } + end + + after(:build) do |project_statistics, evaluator| + if evaluator.with_data + project_statistics.repository_size = evaluator.size_multiplier + project_statistics.wiki_size = evaluator.size_multiplier * 2 + project_statistics.lfs_objects_size = evaluator.size_multiplier * 3 + project_statistics.build_artifacts_size = evaluator.size_multiplier * 4 + project_statistics.packages_size = evaluator.size_multiplier * 5 + end + end end end |