Reenable cli tests on windows (#156)

Also fixes a failing Windows test that has different behavior than Linux/Unix
pull/157/head
Chip Senkbeil 1 year ago committed by GitHub
parent a023b8f22d
commit 9b2f0de0c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -97,7 +97,7 @@ jobs:
target: ${{ matrix.target }}
- uses: taiki-e/install-action@v1
with:
tool: cargo-nextest
tool: cargo-nextest@0.9.45
- uses: Swatinem/rust-cache@v2
- name: Check Cargo availability
run: cargo --version
@ -153,6 +153,10 @@ jobs:
} ELSE {
New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType String -Force
}
- name: Extend Windows retry count to be more resilient
if: matrix.os == 'windows-latest'
run: echo "NEXTEST_RETRIES=9" >> $GITHUB_ENV
shell: bash
- name: Run net tests (default features)
run: cargo nextest run --profile ci --release -p distant-net
- name: Build core (default features)
@ -172,7 +176,6 @@ jobs:
run: cargo build --release
- name: Run CLI tests (all features)
run: cargo nextest run --profile ci --release --all-features
if: matrix.os != 'windows-latest'
ssh-launch-tests:
name: "Test ssh launch using Rust ${{ matrix.rust }} on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
@ -191,7 +194,7 @@ jobs:
toolchain: ${{ matrix.rust }}
- uses: taiki-e/install-action@v1
with:
tool: cargo-nextest
tool: cargo-nextest@0.9.45
- uses: Swatinem/rust-cache@v2
- name: Check Cargo availability
run: cargo --version

@ -220,40 +220,31 @@ async fn should_support_json_to_forward_stdin_to_remote_process(mut json_repl: C
// Now kill the process and wait for it to complete
let id = rand::random::<u64>().to_string();
let res_1 = json_repl
let res = json_repl
.write_and_read_json(json!({
"id": id,
"payload": {
"type": "proc_kill",
"id": proc_id,
},
}))
.await
.unwrap()
.unwrap();
let res_2 = json_repl.read_json_from_stdout().await.unwrap().unwrap();
// The order of responses may be different (kill could come before ok), so we need
// to check that we get one of each type
let got_ok = res_1["payload"]["type"] == "ok" || res_2["payload"]["type"] == "ok";
let got_done =
res_1["payload"]["type"] == "proc_done" || res_2["payload"]["type"] == "proc_done";
if res_1["payload"]["type"] == "ok" {
assert_eq!(res_1["origin_id"], id, "JSON: {res_1}");
} else if res_1["payload"]["type"] == "proc_done" {
assert_eq!(res_1["origin_id"], origin_id, "JSON: {res_1}");
}
if res_2["payload"]["type"] == "ok" {
assert_eq!(res_2["origin_id"], id, "JSON: {res_2}");
} else if res_2["payload"]["type"] == "proc_done" {
assert_eq!(res_2["origin_id"], origin_id, "JSON: {res_2}");
// If the first response we get is proc_done, then we don't care bout the kill result
// as it can be an error if the process ended before the kill happened
//
// NOTE: The above is a situation in Windows, but I've not seen it happen with Mac/Linux.
if res["payload"]["type"] == "ok" {
let res = json_repl.read_json_from_stdout().await.unwrap().unwrap();
assert_eq!(
res["payload"]["type"], "proc_done",
"Did not receive proc_done from killed process: {res}"
);
} else {
assert_eq!(res["payload"]["type"], "proc_done", "JSON: {res}");
}
assert!(got_ok, "Did not receive ok from proc_kill");
assert!(got_done, "Did not receive proc_done from killed process");
}
#[rstest]

Loading…
Cancel
Save