diff --git a/radicle-node/src/test/environment.rs b/radicle-node/src/test/environment.rs index 5b61e92e..35775e20 100644 --- a/radicle-node/src/test/environment.rs +++ b/radicle-node/src/test/environment.rs @@ -165,7 +165,13 @@ impl NodeHandle { /// Wait until this node's routing table contains the given routes. #[track_caller] pub fn routes_to(&self, routes: &[(Id, NodeId)]) { + let mut tries = 0; loop { + // ~3s to converge to the correct routes + if tries > 30 { + panic!("Node::routes_to: routing tables did not converge to include given routes") + } + let mut remaining: BTreeSet<_> = routes.iter().collect(); for (rid, nid) in self.handle.routing().unwrap() { @@ -179,6 +185,7 @@ impl NodeHandle { if remaining.is_empty() { break; } + tries += 1; thread::sleep(Duration::from_millis(100)); } log::debug!(target: "test", "Node {} routes to {:?}", self.id, routes);