31 lines
777 B
Rust
Raw Normal View History

2026-02-02 07:19:22 +01:00
use testing_framework_core::scenario::{
Application, FeedHandle, FeedRuntime, NodeClients, spawn_feed,
};
use tracing::{debug, info};
use crate::deployer::K8sRunnerError;
2026-02-02 07:19:22 +01:00
pub async fn spawn_block_feed_with<E: Application>(
node_clients: &NodeClients<E>,
) -> Result<
(
<<E as Application>::FeedRuntime as FeedRuntime>::Feed,
FeedHandle,
),
K8sRunnerError,
> {
debug!(
2026-02-02 07:19:22 +01:00
nodes = node_clients.len(),
"selecting node client for block feed"
);
let block_source_client = node_clients
2026-02-02 07:19:22 +01:00
.random_client()
.ok_or(K8sRunnerError::BlockFeedMissing)?;
info!("starting block feed");
2026-02-02 07:19:22 +01:00
spawn_feed::<E>(block_source_client)
.await
.map_err(|source| K8sRunnerError::BlockFeed { source })
}