Skip to content

Commit c2db17f

Browse files
committed
fix(common): remove recv_timeout from TestHttpServer Drop to reduce test flakiness
1 parent 090b7dc commit c2db17f

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

mithril-common/src/test_utils/test_http_server.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
// Base code from the httpserver in reqwest tests:
44
// https://github.com/seanmonstar/reqwest/blob/master/tests/support/server.rs
55

6-
use std::{net::SocketAddr, sync::mpsc as std_mpsc, thread, time::Duration};
6+
use std::{net::SocketAddr, sync::mpsc as std_mpsc, thread};
77
use tokio::{runtime, sync::oneshot};
88
use warp::{Filter, Reply};
99

1010
/// A HTTP server for test
1111
pub struct TestHttpServer {
1212
address: SocketAddr,
13-
panic_rx: std_mpsc::Receiver<()>,
1413
shutdown_tx: Option<oneshot::Sender<()>>,
1514
}
1615

@@ -31,12 +30,6 @@ impl Drop for TestHttpServer {
3130
if let Some(tx) = self.shutdown_tx.take() {
3231
let _ = tx.send(());
3332
}
34-
35-
if !::std::thread::panicking() {
36-
self.panic_rx
37-
.recv_timeout(Duration::from_secs(3))
38-
.expect("test server should not panic");
39-
}
4033
}
4134
}
4235

@@ -71,7 +64,7 @@ where
7164
})
7265
});
7366

74-
let (panic_tx, panic_rx) = std_mpsc::channel();
67+
let (panic_tx, _) = std_mpsc::channel();
7568
let thread_name = format!(
7669
"test({})-support-server",
7770
thread::current().name().unwrap_or("<unknown>")
@@ -86,7 +79,6 @@ where
8679

8780
TestHttpServer {
8881
address,
89-
panic_rx,
9082
shutdown_tx: Some(shutdown_tx),
9183
}
9284
})

0 commit comments

Comments
 (0)