Skip to content

Commit 6ea33f7

Browse files
authored
Merge pull request #67 from openssh-rust/fix/no-route
Fix `no_route` on macos
2 parents 14e12b6 + 11baf5b commit 6ea33f7

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

.github/workflows/os-check.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
- 'run_ci_tests.sh'
1515
- 'start_sshd.sh'
1616
- 'stop_sshd.sh'
17-
name: cargo check
17+
name: os check
1818
jobs:
1919
os-check:
2020
runs-on: ${{ matrix.os }}
@@ -29,8 +29,12 @@ jobs:
2929
profile: minimal
3030
toolchain: stable
3131
- uses: actions/checkout@v2
32-
- name: cargo check
32+
- name: Create Cargo.lock
3333
uses: actions-rs/cargo@v1
3434
with:
35-
command: check
35+
command: update
36+
- name: cargo test
37+
uses: actions-rs/cargo@v1
38+
with:
39+
command: test
3640
args: --all-features --all-targets

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_secs(1));
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)