From 792dc754712ecf913a76c6bcbf3074ef7fb51cd7 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Tue, 22 Aug 2023 07:25:38 -0600 Subject: [PATCH] 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 --- cli/tests/integration/inspector_tests.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cli/tests/integration/inspector_tests.rs b/cli/tests/integration/inspector_tests.rs index c507204e47..b4b1f16782 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) {