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/graphql | |
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/graphql')
-rw-r--r-- | spec/graphql/types/namespace_type_spec.rb | 2 | ||||
-rw-r--r-- | spec/graphql/types/root_storage_statistics_type_spec.rb | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/spec/graphql/types/namespace_type_spec.rb b/spec/graphql/types/namespace_type_spec.rb index e1153832cc9..f476dd7286f 100644 --- a/spec/graphql/types/namespace_type_spec.rb +++ b/spec/graphql/types/namespace_type_spec.rb @@ -8,7 +8,7 @@ describe GitlabSchema.types['Namespace'] do it 'has the expected fields' do expected_fields = %w[ id name path full_name full_path description description_html visibility - lfs_enabled request_access_enabled projects + lfs_enabled request_access_enabled projects root_storage_statistics ] is_expected.to have_graphql_fields(*expected_fields) diff --git a/spec/graphql/types/root_storage_statistics_type_spec.rb b/spec/graphql/types/root_storage_statistics_type_spec.rb new file mode 100644 index 00000000000..8c69c13aa73 --- /dev/null +++ b/spec/graphql/types/root_storage_statistics_type_spec.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe GitlabSchema.types['RootStorageStatistics'] do + it { expect(described_class.graphql_name).to eq('RootStorageStatistics') } + + it 'has all the required fields' do + is_expected.to have_graphql_fields(:storage_size, :repository_size, :lfs_objects_size, + :build_artifacts_size, :packages_size, :wiki_size) + end + + it { is_expected.to require_graphql_authorizations(:read_statistics) } +end |