2026-02-02 07:19:22 +01:00
|
|
|
use testing_framework_core::scenario::{
|
|
|
|
|
Application, FeedHandle, FeedRuntime, NodeClients, spawn_feed,
|
|
|
|
|
};
|
2025-12-11 10:08:49 +01:00
|
|
|
use tracing::{debug, info};
|
2025-12-01 12:48:39 +01:00
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
> {
|
2025-12-11 10:08:49 +01:00
|
|
|
debug!(
|
2026-02-02 07:19:22 +01:00
|
|
|
nodes = node_clients.len(),
|
2025-12-11 10:08:49 +01:00
|
|
|
"selecting node client for block feed"
|
|
|
|
|
);
|
|
|
|
|
|
2025-12-01 12:48:39 +01:00
|
|
|
let block_source_client = node_clients
|
2026-02-02 07:19:22 +01:00
|
|
|
.random_client()
|
2025-12-01 12:48:39 +01:00
|
|
|
.ok_or(K8sRunnerError::BlockFeedMissing)?;
|
|
|
|
|
|
|
|
|
|
info!("starting block feed");
|
2026-02-02 07:19:22 +01:00
|
|
|
spawn_feed::<E>(block_source_client)
|
2025-12-01 12:48:39 +01:00
|
|
|
.await
|
|
|
|
|
.map_err(|source| K8sRunnerError::BlockFeed { source })
|
|
|
|
|
}
|