mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-03-31 08:13:48 +00:00
Add batch external-node builder helpers
This commit is contained in:
parent
8721f58d68
commit
6ad6ff33c4
@ -145,8 +145,7 @@ async fn scenario_managed_plus_external_sources_are_orchestrated() -> Result<()>
|
||||
|
||||
let mut scenario = ScenarioBuilder::new(Box::new(deployment_builder))
|
||||
.with_run_duration(Duration::from_secs(5))
|
||||
.with_external_node(seed_cluster.external_sources()[0].clone())
|
||||
.with_external_node(seed_cluster.external_sources()[1].clone())
|
||||
.with_external_nodes(seed_cluster.external_sources().to_vec())
|
||||
.build()?;
|
||||
|
||||
let deployer = ProcessDeployer::<LbcExtEnv>::default();
|
||||
|
||||
@ -276,11 +276,27 @@ macro_rules! impl_common_builder_methods {
|
||||
self.map_core_builder(|builder| builder.with_external_node(node))
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn with_external_nodes(
|
||||
self,
|
||||
nodes: impl IntoIterator<Item = ExternalNodeSource>,
|
||||
) -> Self {
|
||||
self.map_core_builder(|builder| builder.with_external_nodes(nodes))
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn with_external_only_sources(self) -> Self {
|
||||
self.map_core_builder(|builder| builder.with_external_only_sources())
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn with_external_only_nodes(
|
||||
self,
|
||||
nodes: impl IntoIterator<Item = ExternalNodeSource>,
|
||||
) -> Self {
|
||||
self.map_core_builder(|builder| builder.with_external_only_nodes(nodes))
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn run_duration(&self) -> Duration {
|
||||
self.core_builder_ref().run_duration()
|
||||
@ -597,12 +613,32 @@ impl<E: Application, Caps> Builder<E, Caps> {
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn with_external_nodes(
|
||||
mut self,
|
||||
nodes: impl IntoIterator<Item = ExternalNodeSource>,
|
||||
) -> Self {
|
||||
for node in nodes {
|
||||
self.sources = self.sources.with_external_node(node);
|
||||
}
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn with_external_only_sources(mut self) -> Self {
|
||||
self.sources = self.sources.into_external_only();
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn with_external_only_nodes(
|
||||
self,
|
||||
nodes: impl IntoIterator<Item = ExternalNodeSource>,
|
||||
) -> Self {
|
||||
self.with_external_only_sources().with_external_nodes(nodes)
|
||||
}
|
||||
|
||||
fn add_workload(&mut self, workload: Box<dyn Workload<E>>) {
|
||||
self.expectations.extend(workload.expectations());
|
||||
self.workloads.push(workload);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user