Skip to content

Commit

Permalink
Allow some specs to be retried when making real requests and receivin…
Browse files Browse the repository at this point in the history
…g connection error.
  • Loading branch information
bblimke committed Aug 14, 2023
1 parent 0dba7c5 commit 1daebe2
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def connection_refused_exception_class
Errno::ECONNREFUSED
end

def connection_error_class
HTTP::ConnectionError
end

def http_library
:async_http_client
end
Expand Down
3 changes: 3 additions & 0 deletions spec/acceptance/curb/curb_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def connection_refused_exception_class
Curl::Err::ConnectionFailedError
end

def connection_error_class
end

def http_library
:curb
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def connection_refused_exception_class
RuntimeError
end

def connection_error_class
end

def http_library
:em_http_request
end
Expand Down
3 changes: 3 additions & 0 deletions spec/acceptance/excon/excon_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ def connection_refused_exception_class
Excon::Errors::SocketError
end

def connection_error_class
end

def http_library
:excon
end
Expand Down
3 changes: 3 additions & 0 deletions spec/acceptance/http_rb/http_rb_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def connection_refused_exception_class
HTTP::ConnectionError
end

def connection_error_class
end

def http_library
:http_rb
end
Expand Down
3 changes: 3 additions & 0 deletions spec/acceptance/httpclient/httpclient_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ def connection_refused_exception_class
Errno::ECONNREFUSED
end

def connection_error_class
end

def http_library
:httpclient
end
Expand Down
3 changes: 3 additions & 0 deletions spec/acceptance/manticore/manticore_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def connection_refused_exception_class
Manticore::SocketException
end

def connection_error_class
end

def http_library
:manticore
end
Expand Down
3 changes: 3 additions & 0 deletions spec/acceptance/net_http/net_http_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def connection_refused_exception_class
Errno::ECONNREFUSED
end

def connection_error_class
end

def http_library
:net_http
end
Expand Down
3 changes: 3 additions & 0 deletions spec/acceptance/patron/patron_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def connection_refused_exception_class
Patron::ConnectionFailed
end

def connection_error_class
end

def http_library
:patron
end
Expand Down
3 changes: 3 additions & 0 deletions spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def connection_refused_exception_class
FakeTyphoeusHydraConnectError
end

def connection_error_class
end

def http_library
:typhoeus
end
Expand Down
6 changes: 5 additions & 1 deletion spec/acceptance/webmock_shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
end

around(:each, net_connect: true) do |ex|
ex.run_with_retry retry: 2, exceptions_to_retry: [client_timeout_exception_class, connection_refused_exception_class]
ex.run_with_retry retry: 2, exceptions_to_retry: [
client_timeout_exception_class,
connection_refused_exception_class,
connection_error_class
].compact
end

include_context "allowing and disabling net connect", *adapter_info
Expand Down

0 comments on commit 1daebe2

Please sign in to comment.