diff --git a/testing-framework/deployers/local/src/manual/mod.rs b/testing-framework/deployers/local/src/manual/mod.rs index d34f284..74b2195 100644 --- a/testing-framework/deployers/local/src/manual/mod.rs +++ b/testing-framework/deployers/local/src/manual/mod.rs @@ -73,6 +73,11 @@ impl ManualCluster { pub async fn wait_network_ready(&self) -> Result<(), ReadinessError> { self.nodes.wait_network_ready().await } + + pub async fn wait_node_ready(&self, name: &str) -> Result<(), ManualClusterError> { + self.nodes.wait_node_ready(name).await?; + Ok(()) + } } impl Drop for ManualCluster { diff --git a/testing-framework/deployers/local/src/node_control/mod.rs b/testing-framework/deployers/local/src/node_control/mod.rs index 4aab046..dc31d5f 100644 --- a/testing-framework/deployers/local/src/node_control/mod.rs +++ b/testing-framework/deployers/local/src/node_control/mod.rs @@ -51,6 +51,11 @@ pub enum NodeManagerError { #[source] source: DynError, }, + #[error("failed readiness check: {source}")] + Readiness { + #[source] + source: ReadinessError, + }, } pub struct NodeManager { @@ -191,6 +196,31 @@ impl NodeManager { wait_for_http_ports(&ports, E::readiness_endpoint_path()).await } + pub async fn wait_node_ready(&self, name: &str) -> Result<(), NodeManagerError> { + let port = { + let state = self.lock_state(); + let index = + *state + .indices_by_name + .get(name) + .ok_or_else(|| NodeManagerError::NodeName { + name: name.to_string(), + })?; + + state + .nodes + .get(index) + .map(|node| node.endpoints().api.port()) + .ok_or_else(|| NodeManagerError::NodeName { + name: name.to_string(), + })? + }; + + wait_for_http_ports(&[port], E::readiness_endpoint_path()) + .await + .map_err(|source| NodeManagerError::Readiness { source }) + } + pub async fn start_node_with( &self, name: &str,