Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
95b9112e
Commit
95b9112e
authored
Jun 30, 2020
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include snippets_size statistic inside RootStorageStatistics
parent
bf8f3cd8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
2 deletions
+11
-2
app/models/namespace/root_storage_statistics.rb
app/models/namespace/root_storage_statistics.rb
+3
-2
changelogs/unreleased/fj-224487-include-snippets-size-in-root-storage-statistics.yml
...4487-include-snippets-size-in-root-storage-statistics.yml
+5
-0
spec/models/namespace/root_storage_statistics_spec.rb
spec/models/namespace/root_storage_statistics_spec.rb
+3
-0
No files found.
app/models/namespace/root_storage_statistics.rb
View file @
95b9112e
# frozen_string_literal: true
# frozen_string_literal: true
class
Namespace::RootStorageStatistics
<
ApplicationRecord
class
Namespace::RootStorageStatistics
<
ApplicationRecord
STATISTICS_ATTRIBUTES
=
%w(storage_size repository_size wiki_size lfs_objects_size build_artifacts_size packages_size)
.
freeze
STATISTICS_ATTRIBUTES
=
%w(storage_size repository_size wiki_size lfs_objects_size build_artifacts_size packages_size
snippets_size
)
.
freeze
self
.
primary_key
=
:namespace_id
self
.
primary_key
=
:namespace_id
...
@@ -34,7 +34,8 @@ class Namespace::RootStorageStatistics < ApplicationRecord
...
@@ -34,7 +34,8 @@ class Namespace::RootStorageStatistics < ApplicationRecord
'COALESCE(SUM(ps.wiki_size), 0) AS wiki_size'
,
'COALESCE(SUM(ps.wiki_size), 0) AS wiki_size'
,
'COALESCE(SUM(ps.lfs_objects_size), 0) AS lfs_objects_size'
,
'COALESCE(SUM(ps.lfs_objects_size), 0) AS lfs_objects_size'
,
'COALESCE(SUM(ps.build_artifacts_size), 0) AS build_artifacts_size'
,
'COALESCE(SUM(ps.build_artifacts_size), 0) AS build_artifacts_size'
,
'COALESCE(SUM(ps.packages_size), 0) AS packages_size'
'COALESCE(SUM(ps.packages_size), 0) AS packages_size'
,
'COALESCE(SUM(ps.snippets_size), 0) AS snippets_size'
)
)
end
end
end
end
changelogs/unreleased/fj-224487-include-snippets-size-in-root-storage-statistics.yml
0 → 100644
View file @
95b9112e
---
title
:
Include snippets_size statistic inside RootStorageStatistics
merge_request
:
35601
author
:
type
:
changed
spec/models/namespace/root_storage_statistics_spec.rb
View file @
95b9112e
...
@@ -43,6 +43,7 @@ RSpec.describe Namespace::RootStorageStatistics, type: :model do
...
@@ -43,6 +43,7 @@ RSpec.describe Namespace::RootStorageStatistics, type: :model do
total_build_artifacts_size
=
stat1
.
build_artifacts_size
+
stat2
.
build_artifacts_size
total_build_artifacts_size
=
stat1
.
build_artifacts_size
+
stat2
.
build_artifacts_size
total_packages_size
=
stat1
.
packages_size
+
stat2
.
packages_size
total_packages_size
=
stat1
.
packages_size
+
stat2
.
packages_size
total_storage_size
=
stat1
.
storage_size
+
stat2
.
storage_size
total_storage_size
=
stat1
.
storage_size
+
stat2
.
storage_size
total_snippets_size
=
stat1
.
snippets_size
+
stat2
.
snippets_size
expect
(
root_storage_statistics
.
repository_size
).
to
eq
(
total_repository_size
)
expect
(
root_storage_statistics
.
repository_size
).
to
eq
(
total_repository_size
)
expect
(
root_storage_statistics
.
wiki_size
).
to
eq
(
total_wiki_size
)
expect
(
root_storage_statistics
.
wiki_size
).
to
eq
(
total_wiki_size
)
...
@@ -50,6 +51,7 @@ RSpec.describe Namespace::RootStorageStatistics, type: :model do
...
@@ -50,6 +51,7 @@ RSpec.describe Namespace::RootStorageStatistics, type: :model do
expect
(
root_storage_statistics
.
build_artifacts_size
).
to
eq
(
total_build_artifacts_size
)
expect
(
root_storage_statistics
.
build_artifacts_size
).
to
eq
(
total_build_artifacts_size
)
expect
(
root_storage_statistics
.
packages_size
).
to
eq
(
total_packages_size
)
expect
(
root_storage_statistics
.
packages_size
).
to
eq
(
total_packages_size
)
expect
(
root_storage_statistics
.
storage_size
).
to
eq
(
total_storage_size
)
expect
(
root_storage_statistics
.
storage_size
).
to
eq
(
total_storage_size
)
expect
(
root_storage_statistics
.
snippets_size
).
to
eq
(
total_snippets_size
)
end
end
it
'works when there are no projects'
do
it
'works when there are no projects'
do
...
@@ -64,6 +66,7 @@ RSpec.describe Namespace::RootStorageStatistics, type: :model do
...
@@ -64,6 +66,7 @@ RSpec.describe Namespace::RootStorageStatistics, type: :model do
expect
(
root_storage_statistics
.
build_artifacts_size
).
to
eq
(
0
)
expect
(
root_storage_statistics
.
build_artifacts_size
).
to
eq
(
0
)
expect
(
root_storage_statistics
.
packages_size
).
to
eq
(
0
)
expect
(
root_storage_statistics
.
packages_size
).
to
eq
(
0
)
expect
(
root_storage_statistics
.
storage_size
).
to
eq
(
0
)
expect
(
root_storage_statistics
.
storage_size
).
to
eq
(
0
)
expect
(
root_storage_statistics
.
snippets_size
).
to
eq
(
0
)
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment