-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Ensure tcp test case passes when disconnected from network #44647
Conversation
net::tcp::tests::connect_timeout_unroutable fails when the network is unreachable, like on a laptop disconnected from wifi. Check for this error and allow the test to pass. Closes rust-lang#44645
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @dtolnay (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Is there any way to tell that the Other case corresponds to the network being unreachable? Is there a consistent error message across platforms or anything else we could check here?
A few ideas
The first 2 ideas seem a little sketchy to me, and I am guessing the 3rd would need an RFC, but I am out of my depth here so any advice is appreciated! |
Let's go ahead with your fix -- requiring network access for the test suite to succeed seems like an oversight. The risk here is that at some point we mess up connect_timeout so that it always returns some wrong Other error code instead of timing out, and we fail to notice. That seems unlikely and minor enough that merging your fix is more important. If you do want to follow up with another PR to improve the test, any of your 3 ideas sounds good to me. I believe we could do the 3rd one without a formal RFC. The variant would have an #[unstable] attribute when it is added, be unstable for a couple releases, and the libs team would discuss before eventually stabilizing it. The first 2 ideas are fine too and it wouldn't need to be super thorough. Just two different asserts for #[cfg(unix)] and #[cfg(not(unix))] would be decent, where unix looks for ENETUNREACH and not-unix just accepts any Other error like in the current code. @bors r+ rollup |
📌 Commit fcdd46e has been approved by |
Ensure tcp test case passes when disconnected from network net::tcp::tests::connect_timeout_unroutable fails when the network is unreachable, like on a laptop disconnected from wifi. Check for this error and allow the test to pass. Closes rust-lang#44645
Ensure tcp test case passes when disconnected from network net::tcp::tests::connect_timeout_unroutable fails when the network is unreachable, like on a laptop disconnected from wifi. Check for this error and allow the test to pass. Closes rust-lang#44645
Ensure tcp test case passes when disconnected from network net::tcp::tests::connect_timeout_unroutable fails when the network is unreachable, like on a laptop disconnected from wifi. Check for this error and allow the test to pass. Closes rust-lang#44645
net::tcp::tests::connect_timeout_unroutable fails when the network
is unreachable, like on a laptop disconnected from wifi. Check for
this error and allow the test to pass.
Closes #44645