diff options
Diffstat (limited to 'spec/lib/gitlab/import_export/decompressed_archive_size_validator_spec.rb')
-rw-r--r-- | spec/lib/gitlab/import_export/decompressed_archive_size_validator_spec.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/spec/lib/gitlab/import_export/decompressed_archive_size_validator_spec.rb b/spec/lib/gitlab/import_export/decompressed_archive_size_validator_spec.rb index aceea70be92..04e25dee905 100644 --- a/spec/lib/gitlab/import_export/decompressed_archive_size_validator_spec.rb +++ b/spec/lib/gitlab/import_export/decompressed_archive_size_validator_spec.rb @@ -13,13 +13,13 @@ RSpec.describe Gitlab::ImportExport::DecompressedArchiveSizeValidator, feature_c FileUtils.rm(filepath) end - subject { described_class.new(archive_path: filepath, max_bytes: max_bytes) } + subject { described_class.new(archive_path: filepath) } describe '#valid?' do - let(:max_bytes) { 1 } - context 'when file does not exceed allowed decompressed size' do - let(:max_bytes) { 20 } + before do + stub_application_setting(max_decompressed_archive_size: 20) + end it 'returns true' do expect(subject.valid?).to eq(true) @@ -35,6 +35,10 @@ RSpec.describe Gitlab::ImportExport::DecompressedArchiveSizeValidator, feature_c end context 'when file exceeds allowed decompressed size' do + before do + stub_application_setting(max_decompressed_archive_size: 0.000001) + end + it 'logs error message returns false' do expect(Gitlab::Import::Logger) .to receive(:info) @@ -93,7 +97,7 @@ RSpec.describe Gitlab::ImportExport::DecompressedArchiveSizeValidator, feature_c end context 'when timeout occurs' do - let(:error_message) { 'Timeout reached during archive decompression' } + let(:error_message) { 'Timeout of 210 seconds reached during archive decompression' } let(:exception) { Timeout::Error } include_examples 'logs raised exception and terminates validator process group' |