Remove useless unit tests

This commit is contained in:
Eval EXEC 2023-06-20 18:47:31 +08:00
parent 30e1c1a53c
commit a0c757a13f
No known key found for this signature in database
GPG Key ID: 0F0272C0D3AC91F7

View File

@ -46,17 +46,6 @@ fn connect_error() {
} }
} }
#[test]
fn connect_timeout_to_unreachable_address() {
let now = Instant::now();
match TcpStream::connect_timeout(&format!("1.1.1.1:9999").parse().unwrap(), Duration::MAX) {
Ok(..) => panic!("connected to an unreachable address, this is impossible"),
Err(e) => assert_eq!(e.kind(), ErrorKind::TimedOut),
}
assert!(now.elapsed() > Duration::from_secs(20));
}
#[test] #[test]
#[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31 #[cfg_attr(target_env = "sgx", ignore)] // FIXME: https://github.com/fortanix/rust-sgx/issues/31
fn connect_timeout_error() { fn connect_timeout_error() {
@ -68,16 +57,6 @@ fn connect_timeout_error() {
assert!(TcpStream::connect_timeout(&socket_addr, Duration::MAX).is_ok()); assert!(TcpStream::connect_timeout(&socket_addr, Duration::MAX).is_ok());
} }
#[test]
fn connect_timeout_ok_bind() {
let listener = TcpListener::bind("127.0.0.1:0").unwrap(); // :0 picks some free port
let port = listener.local_addr().unwrap().port(); // obtain the port it picked
assert!(
TcpStream::connect_timeout(&format!("127.0.0.1:{port}").parse().unwrap(), Duration::MAX)
.is_ok()
);
}
#[test] #[test]
fn listen_localhost() { fn listen_localhost() {
let socket_addr = next_test_ip4(); let socket_addr = next_test_ip4();