Skip to content

Commit

Permalink
fix async fds test in github actions
Browse files Browse the repository at this point in the history
apparently gha leaves some extra fds open when spawning processes
  • Loading branch information
doy committed Jan 28, 2025
1 parent 096713d commit d8a2efa
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/fds_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ mod helpers;
fn test_fds_async() {
use futures::stream::StreamExt as _;

check_open_fds(&[0, 1, 2]);
let mut expected = String::new();
for fd in get_open_fds() {
expected.push_str(&format!("{}", fd));
}

let rt = tokio::runtime::Builder::new_multi_thread()
.enable_all()
Expand All @@ -30,7 +33,7 @@ fn test_fds_async() {

let (pty_r, _) = pty.split();
let mut output = helpers::output_async(pty_r);
assert_eq!(output.next().await.unwrap(), "012\r\n");
assert_eq!(output.next().await.unwrap(), "{expected}\r\n");

let status = child.wait().await.unwrap();
assert_eq!(status.code().unwrap(), 0);
Expand All @@ -54,7 +57,7 @@ fn test_fds_async() {

let (pty_r, _) = pty.split();
let mut output = helpers::output_async(pty_r);
assert_eq!(output.next().await.unwrap(), "012\r\n");
assert_eq!(output.next().await.unwrap(), "{expected}\r\n");

let status = child.wait().await.unwrap();
assert_eq!(status.code().unwrap(), 0);
Expand All @@ -78,7 +81,7 @@ fn test_fds_async() {

let (pty_r, _) = pty.split();
let mut output = helpers::output_async(pty_r);
assert_eq!(output.next().await.unwrap(), "012\r\n");
assert_eq!(output.next().await.unwrap(), "{expected}\r\n");

let status = child.wait().await.unwrap();
assert_eq!(status.code().unwrap(), 0);
Expand Down

0 comments on commit d8a2efa

Please sign in to comment.