summaryrefslogtreecommitdiff
path: root/cli/tests/integration/inspector_tests.rs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-08-22 07:25:38 -0600
committerGitHub <noreply@github.com>2023-08-22 07:25:38 -0600
commit792dc754712ecf913a76c6bcbf3074ef7fb51cd7 (patch)
tree338bbf1ced4b5c536cf6e15ff59855ff296a0257 /cli/tests/integration/inspector_tests.rs
parent8649648b438d67e4ca3dbedf57367c0ecfc3698e (diff)
fix(cli): add timeout on inspector tests (#20225)
I believe this test locked up on this run below: https://github.com/denoland/deno/actions/runs/5928630684/job/16074661291
Diffstat (limited to 'cli/tests/integration/inspector_tests.rs')
-rw-r--r--cli/tests/integration/inspector_tests.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/cli/tests/integration/inspector_tests.rs b/cli/tests/integration/inspector_tests.rs
index c507204e4..b4b1f1678 100644
--- a/cli/tests/integration/inspector_tests.rs
+++ b/cli/tests/integration/inspector_tests.rs
@@ -16,9 +16,11 @@ use hyper::Body;
use hyper::Request;
use hyper::Response;
use std::io::BufRead;
+use std::time::Duration;
use test_util as util;
use test_util::TempDir;
use tokio::net::TcpStream;
+use tokio::time::timeout;
use url::Url;
use util::assert_starts_with;
use util::http_server;
@@ -154,7 +156,11 @@ impl InspectorTester {
async fn recv(&mut self) -> String {
loop {
- let result = self.socket.read_frame().await.map_err(|e| anyhow!(e));
+ // In the rare case this locks up, don't wait longer than one minute
+ let result = timeout(Duration::from_secs(60), self.socket.read_frame())
+ .await
+ .expect("recv() timeout")
+ .map_err(|e| anyhow!(e));
let message =
String::from_utf8(self.handle_error(result).payload.to_vec()).unwrap();
if (self.notification_filter)(&message) {