summaryrefslogtreecommitdiff
path: root/spec/services/projects/lfs_pointers/lfs_download_service_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/projects/lfs_pointers/lfs_download_service_spec.rb')
-rw-r--r--spec/services/projects/lfs_pointers/lfs_download_service_spec.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/services/projects/lfs_pointers/lfs_download_service_spec.rb b/spec/services/projects/lfs_pointers/lfs_download_service_spec.rb
index 6c7164c5e06..c815ad38843 100644
--- a/spec/services/projects/lfs_pointers/lfs_download_service_spec.rb
+++ b/spec/services/projects/lfs_pointers/lfs_download_service_spec.rb
@@ -108,7 +108,7 @@ RSpec.describe Projects::LfsPointers::LfsDownloadService do
end
end
- context 'when file download fails' do
+ context 'when file downloading response code is not success' do
before do
allow(Gitlab::HTTP).to receive(:get).and_return(code: 500, 'success?' => false)
end
@@ -122,6 +122,20 @@ RSpec.describe Projects::LfsPointers::LfsDownloadService do
end
end
+ context 'when file downloading request timeout few times' do
+ before do
+ allow(Gitlab::HTTP).to receive(:get).and_raise(Net::OpenTimeout)
+ end
+
+ it_behaves_like 'no lfs object is created'
+
+ it 'retries to get LFS object 3 times before raising exception' do
+ subject.execute
+
+ expect(Gitlab::HTTP).to have_received(:get).exactly(3).times
+ end
+ end
+
context 'when file download returns a redirect' do
let(:redirect_link) { 'http://external-link' }