zombienet_orchestrator/network_helper/
verifier.rs1use std::time::Duration;
2
3use tokio::time::timeout;
4use tracing::trace;
5
6use crate::network::node::NetworkNode;
7
8pub(crate) async fn verify_nodes(nodes: &[&NetworkNode]) -> Result<(), anyhow::Error> {
9 timeout(Duration::from_secs(90), check_nodes(nodes))
10 .await
11 .map_err(|_| anyhow::anyhow!("one or more nodes are not ready!"))
12}
13
14async fn check_nodes(nodes: &[&NetworkNode]) {
18 loop {
19 let tasks: Vec<_> = nodes
20 .iter()
21 .map(|node| {
22 trace!("🔎 checking node: {} ", node.name);
23 reqwest::get(node.prometheus_uri.clone())
24 })
25 .collect();
26
27 let all_ready = futures::future::try_join_all(tasks).await;
28 if all_ready.is_ok() {
29 return;
30 }
31
32 tokio::time::sleep(Duration::from_millis(1000)).await;
33 }
34}