Ensure tcp test case passes when disconnected from network · rust-lang/rust@fcdd46e (original) (raw)

Original file line number Diff line number Diff line change
@@ -1570,10 +1570,13 @@ mod tests {
1570 1570
1571 1571 #[test]
1572 1572 fn connect_timeout_unroutable() {
1573 -// this IP is unroutable, so connections should always time out.
1573 +// this IP is unroutable, so connections should always time out,
1574 +// provided the network is reachable to begin with.
1574 1575 let addr = "10.255.255.1:80".parse().unwrap();
1575 1576 let e = TcpStream::connect_timeout(&addr, Duration::from_millis(250)).unwrap_err();
1576 -assert_eq!(e.kind(), io::ErrorKind::TimedOut);
1577 +assert!(e.kind() == io::ErrorKind::TimedOut |
1578 + e.kind() == io::ErrorKind::Other,
1579 +"bad error: {} {:?}", e, e.kind());
1577 1580 }
1578 1581
1579 1582 #[test]