File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,10 +105,17 @@ def evict(uri)
105105
106106 HTTP_ERRORS = [
107107 EOFError ,
108+ Errno ::ECONNABORTED ,
108109 Errno ::ECONNREFUSED ,
109110 Errno ::ECONNRESET ,
111+ Errno ::EHOSTDOWN ,
110112 Errno ::EHOSTUNREACH ,
111113 Errno ::EINVAL ,
114+ Errno ::ENETDOWN ,
115+ Errno ::ENETRESET ,
116+ Errno ::ENETUNREACH ,
117+ Errno ::ENONET ,
118+ Errno ::ENOTCONN ,
112119 Errno ::EPIPE ,
113120 Errno ::ETIMEDOUT ,
114121 Net ::HTTPBadResponse ,
Original file line number Diff line number Diff line change @@ -355,6 +355,23 @@ def suppress_internet_availability_check
355355 end
356356 end
357357
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+
358375 it 'should use the buildpack cache if the cache configuration disables remote downloads' do
359376 YAML . stub ( :load_file ) . with ( File . expand_path ( 'config/cache.yml' ) ) . and_return (
360377 'remote_downloads' => 'disabled' )
You can’t perform that action at this time.
0 commit comments