Skip to content

Commit c9834b2

Browse files
authored
Merge pull request #2495 from input-output-hk/dlachaume/client-integration-test-flaky
Fix: Simplify `TestHttpServer` `Drop` logic to prevent test flakiness
2 parents 2b88e17 + d59e27f commit c9834b2

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mithril-common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-common"
3-
version = "0.5.30"
3+
version = "0.5.31"
44
description = "Common types, interfaces, and utilities for Mithril nodes."
55
authors = { workspace = true }
66
edition = { workspace = true }

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)