Skip to content
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

tests: handle ECONNREFUSED in uds_stream::epollhup #6778

Merged
merged 2 commits into from
Aug 16, 2024
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: 12 additions & 1 deletion tokio/tests/uds_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,17 @@ async fn epollhup() -> io::Result<()> {
drop(listener);

let err = connect.await.unwrap_err();
assert_eq!(err.kind(), io::ErrorKind::ConnectionReset);
let errno = err.kind();
assert!(
// As far as I can tell, whether we see ECONNREFUSED or ECONNRESET here
// seems relatively inconsistent, at least on non-Linux operating
// systems. The difference in meaning between these errnos is not
// particularly well-defined, so let's just accept either.
matches!(
errno,
io::ErrorKind::ConnectionRefused | io::ErrorKind::ConnectionReset
),
"unexpected error kind: {errno:?} (expected ConnectionRefused or ConnectionReset)"
);
Ok(())
}
Loading