diff options
author | Vasilii Iakliushin <viakliushin@gitlab.com> | 2020-12-03 16:01:58 +0300 |
---|---|---|
committer | Vasilii Iakliushin <viakliushin@gitlab.com> | 2020-12-03 16:10:48 +0300 |
commit | 1023c01c7275d1ea2456d420a1b9947fcff7bffd (patch) | |
tree | 32b148b10295510335cacf869c2d842e7465f085 | |
parent | bdba5ba9ed8bab629c293806e4b3bc12575530bc (diff) |
Add test to validate the maximum size of the `content` directory
Based on suggestion:
https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/4726#note_459473659
We are going to include part of the gitlab-docs repository to the
Omnibus package. But the Omnibus package has a strict size limit. The
new test will check if the `content` directory size does not exceed
the limit.
-rw-r--r-- | spec/gitlab/content_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/gitlab/content_spec.rb b/spec/gitlab/content_spec.rb new file mode 100644 index 00000000..bfa35ab8 --- /dev/null +++ b/spec/gitlab/content_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +# See: https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/4726#note_459473659 +describe 'Content directory size' do + subject { Dir.glob('content/**/*').sum { |f| File.size(f) } } + + let(:megabyte) { 1024 ** 2 } + + # This limit can be increased after checking that Omnibus package build does not fail + let(:maximum_size) { 2 * megabyte } + + # `content` directory is included to the Omnibus package + # We want to make sure that the size of the directory is small enough + # to prevent accidental Omnibus pipeline failures. + it 'is not too big' do + is_expected.to be < maximum_size + end +end |