Skip to content

Commit e88976c

Browse files
committed
Use WithOutput in the tests instead of reimplementing
1 parent 6a0724c commit e88976c

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

compiler/base/orchestrator/src/coordinator.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,8 +1441,6 @@ mod tests {
14411441
use futures::{future::try_join_all, Future, FutureExt};
14421442
use std::{sync::Once, time::Duration};
14431443
use tempdir::TempDir;
1444-
use tokio::join;
1445-
use tokio_stream::{wrappers::ReceiverStream, StreamExt};
14461444

14471445
use super::*;
14481446

@@ -1776,16 +1774,13 @@ mod tests {
17761774
stderr_rx,
17771775
} = coordinator.begin_compile(req).await.unwrap();
17781776

1779-
let stdout = ReceiverStream::new(stdout_rx);
1780-
let stdout = stdout.collect::<String>();
1781-
1782-
let stderr = ReceiverStream::new(stderr_rx);
1783-
let stderr = stderr.collect::<String>();
1784-
1785-
let (complete, _stdout, stderr) =
1786-
async { join!(task, stdout, stderr) }.with_timeout().await;
1787-
1788-
let response = complete.unwrap();
1777+
let WithOutput {
1778+
response,
1779+
stdout: _,
1780+
stderr,
1781+
} = WithOutput::try_absorb(task, stdout_rx, stderr_rx)
1782+
.await
1783+
.unwrap();
17891784

17901785
assert!(response.success, "stderr: {}", stderr);
17911786
assert_contains!(stderr, "Compiling");

0 commit comments

Comments
 (0)