Skip to content

Commit 6931b49

Browse files
committed
Fix no_route on macos
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
1 parent 403963e commit 6931b49

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/openssh.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ async fn connects() -> Vec<Session> {
7676
}
7777

7878
async fn connects_err(host: &str) -> Vec<Error> {
79-
let mut builder = SessionBuilder::default();
79+
session_builder_connects_err(host, SessionBuilder::default()).await
80+
}
8081

82+
async fn session_builder_connects_err(host: &str, mut builder: SessionBuilder) -> Vec<Error> {
8183
builder
8284
.user_known_hosts_file(get_known_hosts_path())
8385
.known_hosts_check(KnownHosts::Accept);
@@ -669,11 +671,15 @@ async fn cannot_resolve() {
669671

670672
#[tokio::test]
671673
async fn no_route() {
672-
for err in connects_err("255.255.255.255").await {
674+
let mut builder = SessionBuilder::default();
675+
676+
builder.connect_timeout(Duration::from_nanos(0));
677+
678+
for err in session_builder_connects_err("192.0.2.1", builder).await {
673679
match err {
674680
Error::Connect(e) => {
675681
eprintln!("{:?}", e);
676-
assert_eq!(e.kind(), io::ErrorKind::Other);
682+
assert_eq!(e.kind(), io::ErrorKind::TimedOut);
677683
}
678684
e => unreachable!("{:?}", e),
679685
}

0 commit comments

Comments
 (0)