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
c4d23d13
Commit
c4d23d13
authored
Aug 25, 2020
by
Maxime Orefice
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update root_storage_statistics with pipeline_artifacts_size
parent
07d9344a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
app/models/namespace/root_storage_statistics.rb
app/models/namespace/root_storage_statistics.rb
+12
-2
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 @
c4d23d13
...
...
@@ -2,7 +2,16 @@
class
Namespace::RootStorageStatistics
<
ApplicationRecord
SNIPPETS_SIZE_STAT_NAME
=
'snippets_size'
.
freeze
STATISTICS_ATTRIBUTES
=
%W(storage_size repository_size wiki_size lfs_objects_size build_artifacts_size packages_size
#{
SNIPPETS_SIZE_STAT_NAME
}
)
.
freeze
STATISTICS_ATTRIBUTES
=
%W(
storage_size
repository_size
wiki_size
lfs_objects_size
build_artifacts_size
packages_size
#{
SNIPPETS_SIZE_STAT_NAME
}
pipeline_artifacts_size
)
.
freeze
self
.
primary_key
=
:namespace_id
...
...
@@ -40,7 +49,8 @@ class Namespace::RootStorageStatistics < ApplicationRecord
'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.packages_size), 0) AS packages_size'
,
"COALESCE(SUM(ps.snippets_size), 0) AS
#{
SNIPPETS_SIZE_STAT_NAME
}
"
"COALESCE(SUM(ps.snippets_size), 0) AS
#{
SNIPPETS_SIZE_STAT_NAME
}
"
,
'COALESCE(SUM(ps.pipeline_artifacts_size), 0) AS pipeline_artifacts_size'
)
end
...
...
spec/models/namespace/root_storage_statistics_spec.rb
View file @
c4d23d13
...
...
@@ -44,6 +44,7 @@ RSpec.describe Namespace::RootStorageStatistics, type: :model do
total_packages_size
=
stat1
.
packages_size
+
stat2
.
packages_size
total_storage_size
=
stat1
.
storage_size
+
stat2
.
storage_size
total_snippets_size
=
stat1
.
snippets_size
+
stat2
.
snippets_size
total_pipeline_artifacts_size
=
stat1
.
pipeline_artifacts_size
+
stat2
.
pipeline_artifacts_size
expect
(
root_storage_statistics
.
repository_size
).
to
eq
(
total_repository_size
)
expect
(
root_storage_statistics
.
wiki_size
).
to
eq
(
total_wiki_size
)
...
...
@@ -52,6 +53,7 @@ RSpec.describe Namespace::RootStorageStatistics, type: :model do
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
.
snippets_size
).
to
eq
(
total_snippets_size
)
expect
(
root_storage_statistics
.
pipeline_artifacts_size
).
to
eq
(
total_pipeline_artifacts_size
)
end
it
'works when there are no projects'
do
...
...
@@ -67,6 +69,7 @@ RSpec.describe Namespace::RootStorageStatistics, type: :model do
expect
(
root_storage_statistics
.
packages_size
).
to
eq
(
0
)
expect
(
root_storage_statistics
.
storage_size
).
to
eq
(
0
)
expect
(
root_storage_statistics
.
snippets_size
).
to
eq
(
0
)
expect
(
root_storage_statistics
.
pipeline_artifacts_size
).
to
eq
(
0
)
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