1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-29 02:29:06 -05:00

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
This commit is contained in:
Matt Mastracci 2023-08-22 07:25:38 -06:00
parent f65461f764
commit ba9892a213

View file

@ -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) {