mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-21 18:40:39 +08:00
node: Reduce test flakiness
Most of the test flakiness was caused by the git-daemon not being able to bind to a port. It seems like using an RNG was not a good enough solution. After this change, tests seem to be passing without issue.
This commit is contained in:
@@ -301,7 +301,13 @@ impl<G: cyphernet::Ecdh<Pk = NodeId> + Signer + Clone> Node<G> {
|
||||
pub fn spawn(self, config: service::Config) -> NodeHandle<G> {
|
||||
let listen = vec![([0, 0, 0, 0], 0).into()];
|
||||
let proxy = net::SocketAddr::new(net::Ipv4Addr::LOCALHOST.into(), 9050);
|
||||
let daemon = ([0, 0, 0, 0], fastrand::u16(1025..)).into();
|
||||
let daemon: net::SocketAddr = {
|
||||
// Find free port for git-daemon to bind to.
|
||||
// This is a somewhat racy solution, though it works much better than assigning a random
|
||||
// port.
|
||||
let sock = net::TcpListener::bind("0.0.0.0:0").unwrap();
|
||||
([0, 0, 0, 0], sock.local_addr().unwrap().port()).into()
|
||||
};
|
||||
let (_, signals) = chan::bounded(1);
|
||||
let rt = Runtime::init(
|
||||
self.home.clone(),
|
||||
|
||||
Reference in New Issue
Block a user