DEV: Patch capybara to ignore client-triggered errors (#19972)
In dev/prod, these are absorbed by unicorn. Most commonly, they occur when a client interrupts a message-bus long-polling request.
Also reverts the EPIPE workaround introduced in 011c9b9973
This commit is contained in:
parent
e2db764cdd
commit
eee97ad29a
|
@ -105,8 +105,6 @@ MessageBus.on_middleware_error do |env, e|
|
||||||
[403, {}, ["Invalid Access"]]
|
[403, {}, ["Invalid Access"]]
|
||||||
elsif RateLimiter::LimitExceeded === e
|
elsif RateLimiter::LimitExceeded === e
|
||||||
[429, { "Retry-After" => e.available_in.to_s }, [e.description]]
|
[429, { "Retry-After" => e.available_in.to_s }, [e.description]]
|
||||||
elsif Errno::EPIPE === e
|
|
||||||
[422, {}, ["Closed by Client"]]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -252,6 +252,17 @@ RSpec.configure do |config|
|
||||||
capybara_config.server_port = 31_337 + ENV["TEST_ENV_NUMBER"].to_i
|
capybara_config.server_port = 31_337 + ENV["TEST_ENV_NUMBER"].to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module IgnoreUnicornCapturedErrors
|
||||||
|
def raise_server_error!
|
||||||
|
super
|
||||||
|
rescue EOFError, Errno::ECONNRESET, Errno::EPIPE, Errno::ENOTCONN => e
|
||||||
|
# Ignore these exceptions - caused by client. Handled by unicorn in dev/prod
|
||||||
|
# https://github.com/defunkt/unicorn/blob/d947cb91cf/lib/unicorn/http_server.rb#L570-L573
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Capybara::Session.class_eval { prepend IgnoreUnicornCapturedErrors }
|
||||||
|
|
||||||
# The valid values for SELENIUM_BROWSER_LOG_LEVEL are:
|
# The valid values for SELENIUM_BROWSER_LOG_LEVEL are:
|
||||||
#
|
#
|
||||||
# OFF
|
# OFF
|
||||||
|
|
Loading…
Reference in New Issue