diff options
author | Alessio Caiazza <acaiazza@gitlab.com> | 2019-08-22 22:08:28 +0000 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2019-08-22 22:08:28 +0000 |
commit | 606a1d2d31aff69ddabe7e3794f61f3e778da3e8 (patch) | |
tree | bfaee792fd551070a3581c77bc52164610f03b2a /spec/lib | |
parent | c65ea080ba8637f0e83ea97b091e4ab3ebbce635 (diff) | |
download | gitlab-ce-606a1d2d31aff69ddabe7e3794f61f3e778da3e8.tar.gz |
Expose namespace storage statistics with GraphQL
Root namespaces have storage statistics.
This commit allows namespace owners to get those stats via GraphQL
queries like the following one
{
namespace(fullPath: "a_namespace_path") {
rootStorageStatistics {
storageSize
repositorySize
lfsObjectsSize
buildArtifactsSize
packagesSize
wikiSize
}
}
}
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/graphql/loaders/batch_root_storage_statistics_loader_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/lib/gitlab/graphql/loaders/batch_root_storage_statistics_loader_spec.rb b/spec/lib/gitlab/graphql/loaders/batch_root_storage_statistics_loader_spec.rb new file mode 100644 index 00000000000..38931f7ab5e --- /dev/null +++ b/spec/lib/gitlab/graphql/loaders/batch_root_storage_statistics_loader_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Gitlab::Graphql::Loaders::BatchRootStorageStatisticsLoader do + describe '#find' do + it 'only queries once for project statistics' do + stats = create_list(:namespace_root_storage_statistics, 2) + namespace1 = stats.first.namespace + namespace2 = stats.last.namespace + + expect do + described_class.new(namespace1.id).find + described_class.new(namespace2.id).find + end.not_to exceed_query_limit(1) + end + end +end |