Skip to content

✅ Ignore more IO errors in some FakeServer tests #421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions test/net/imap/fake_server/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

module Net::IMAP::FakeServer::TestHelper

IO_ERRORS = [
IOError,
EOFError,
Errno::ECONNABORTED,
Errno::ECONNRESET,
Errno::EPIPE,
Errno::ETIMEDOUT,
].freeze

def run_fake_server_in_thread(ignore_io_error: false,
report_on_exception: true,
timeout: 10, **opts)
Expand All @@ -13,14 +22,14 @@ def run_fake_server_in_thread(ignore_io_error: false,
Thread.current.abort_on_exception = false
Thread.current.report_on_exception = report_on_exception
server.run
rescue IOError
rescue *IO_ERRORS
raise unless ignore_io_error
end
yield server
ensure
begin
server&.shutdown
rescue IOError
rescue *IO_ERRORS
raise unless ignore_io_error
end
end
Expand Down
Loading