From 68ca4a3263b4e0ba008f5f32825a58449702174d Mon Sep 17 00:00:00 2001 From: Damien Lachaume <135982616+dlachaume@users.noreply.github.com> Date: Mon, 19 May 2025 10:03:15 +0200 Subject: [PATCH] fix(common): remove `recv_timeout` from `TestHttpServer` `Drop` to reduce test flakiness --- mithril-common/src/test_utils/test_http_server.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/mithril-common/src/test_utils/test_http_server.rs b/mithril-common/src/test_utils/test_http_server.rs index 6dcf88945e3..f31e62b20be 100644 --- a/mithril-common/src/test_utils/test_http_server.rs +++ b/mithril-common/src/test_utils/test_http_server.rs @@ -3,14 +3,13 @@ // Base code from the httpserver in reqwest tests: // https://github.com/seanmonstar/reqwest/blob/master/tests/support/server.rs -use std::{net::SocketAddr, sync::mpsc as std_mpsc, thread, time::Duration}; +use std::{net::SocketAddr, sync::mpsc as std_mpsc, thread}; use tokio::{runtime, sync::oneshot}; use warp::{Filter, Reply}; /// A HTTP server for test pub struct TestHttpServer { address: SocketAddr, - panic_rx: std_mpsc::Receiver<()>, shutdown_tx: Option>, } @@ -31,12 +30,6 @@ impl Drop for TestHttpServer { if let Some(tx) = self.shutdown_tx.take() { let _ = tx.send(()); } - - if !::std::thread::panicking() { - self.panic_rx - .recv_timeout(Duration::from_secs(3)) - .expect("test server should not panic"); - } } } @@ -71,7 +64,7 @@ where }) }); - let (panic_tx, panic_rx) = std_mpsc::channel(); + let (panic_tx, _) = std_mpsc::channel(); let thread_name = format!( "test({})-support-server", thread::current().name().unwrap_or("") @@ -86,7 +79,6 @@ where TestHttpServer { address, - panic_rx, shutdown_tx: Some(shutdown_tx), } })