File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -105,10 +105,17 @@ def evict(uri)
105
105
106
106
HTTP_ERRORS = [
107
107
EOFError ,
108
+ Errno ::ECONNABORTED ,
108
109
Errno ::ECONNREFUSED ,
109
110
Errno ::ECONNRESET ,
111
+ Errno ::EHOSTDOWN ,
110
112
Errno ::EHOSTUNREACH ,
111
113
Errno ::EINVAL ,
114
+ Errno ::ENETDOWN ,
115
+ Errno ::ENETRESET ,
116
+ Errno ::ENETUNREACH ,
117
+ Errno ::ENONET ,
118
+ Errno ::ENOTCONN ,
112
119
Errno ::EPIPE ,
113
120
Errno ::ETIMEDOUT ,
114
121
Net ::HTTPBadResponse ,
Original file line number Diff line number Diff line change @@ -355,6 +355,23 @@ def suppress_internet_availability_check
355
355
end
356
356
end
357
357
358
+ it 'should use the buildpack cache if the download cannot be completed because Errno::ENETUNREACH is raised' do
359
+ stub_request ( :get , 'http://foo-uri/' ) . to_raise ( Errno ::ENETUNREACH )
360
+
361
+ Dir . mktmpdir do |root |
362
+ Dir . mktmpdir do |buildpack_cache |
363
+ java_buildpack_cache = File . join ( buildpack_cache , 'java-buildpack' )
364
+ FileUtils . mkdir_p java_buildpack_cache
365
+ touch java_buildpack_cache , 'cached' , 'foo-stashed'
366
+ with_buildpack_cache ( buildpack_cache ) do
367
+ DownloadCache . new ( root ) . get ( 'http://foo-uri/' ) do |file |
368
+ expect ( file . read ) . to eq ( 'foo-stashed' )
369
+ end
370
+ end
371
+ end
372
+ end
373
+ end
374
+
358
375
it 'should use the buildpack cache if the cache configuration disables remote downloads' do
359
376
YAML . stub ( :load_file ) . with ( File . expand_path ( 'config/cache.yml' ) ) . and_return (
360
377
'remote_downloads' => 'disabled' )
You can’t perform that action at this time.
0 commit comments