mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-01-07 15:53:10 +00:00
Add *_with helpers for DSL blocks and apply to examples
This commit is contained in:
parent
c0555ca347
commit
7e544c8838
@ -49,22 +49,23 @@ async fn run_compose_case(
|
|||||||
.executors(executors)
|
.executors(executors)
|
||||||
})
|
})
|
||||||
.enable_node_control()
|
.enable_node_control()
|
||||||
.chaos()
|
.chaos_with(|c| {
|
||||||
.restart()
|
c.restart()
|
||||||
// Keep chaos restarts outside the test run window to avoid crash loops on restart.
|
// Keep chaos restarts outside the test run window to avoid crash loops on restart.
|
||||||
.min_delay(Duration::from_secs(120))
|
.min_delay(Duration::from_secs(120))
|
||||||
.max_delay(Duration::from_secs(180))
|
.max_delay(Duration::from_secs(180))
|
||||||
.target_cooldown(Duration::from_secs(240))
|
.target_cooldown(Duration::from_secs(240))
|
||||||
.apply()
|
.apply()
|
||||||
|
})
|
||||||
.wallets(TOTAL_WALLETS)
|
.wallets(TOTAL_WALLETS)
|
||||||
.transactions()
|
.transactions_with(|txs| {
|
||||||
.rate(MIXED_TXS_PER_BLOCK)
|
txs.rate(MIXED_TXS_PER_BLOCK)
|
||||||
.users(TRANSACTION_WALLETS)
|
.users(TRANSACTION_WALLETS)
|
||||||
.apply()
|
})
|
||||||
.da()
|
.da_with(|da| {
|
||||||
.channel_rate(1)
|
da.channel_rate(1)
|
||||||
.blob_rate(1)
|
.blob_rate(1)
|
||||||
.apply()
|
})
|
||||||
.with_run_duration(run_duration)
|
.with_run_duration(run_duration)
|
||||||
.expect_consensus_liveness()
|
.expect_consensus_liveness()
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@ -45,14 +45,14 @@ async fn run_k8s_case(
|
|||||||
.executors(executors)
|
.executors(executors)
|
||||||
})
|
})
|
||||||
.wallets(TOTAL_WALLETS)
|
.wallets(TOTAL_WALLETS)
|
||||||
.transactions()
|
.transactions_with(|txs| {
|
||||||
.rate(MIXED_TXS_PER_BLOCK)
|
txs.rate(MIXED_TXS_PER_BLOCK)
|
||||||
.users(TRANSACTION_WALLETS)
|
.users(TRANSACTION_WALLETS)
|
||||||
.apply()
|
})
|
||||||
.da()
|
.da_with(|da| {
|
||||||
.channel_rate(1)
|
da.channel_rate(1)
|
||||||
.blob_rate(1)
|
.blob_rate(1)
|
||||||
.apply()
|
})
|
||||||
.with_run_duration(run_duration)
|
.with_run_duration(run_duration)
|
||||||
.expect_consensus_liveness()
|
.expect_consensus_liveness()
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@ -53,14 +53,14 @@ async fn run_local_case(
|
|||||||
.executors(executors)
|
.executors(executors)
|
||||||
})
|
})
|
||||||
.wallets(TOTAL_WALLETS)
|
.wallets(TOTAL_WALLETS)
|
||||||
.transactions()
|
.transactions_with(|txs| {
|
||||||
.rate(MIXED_TXS_PER_BLOCK)
|
txs.rate(MIXED_TXS_PER_BLOCK)
|
||||||
.users(TRANSACTION_WALLETS)
|
.users(TRANSACTION_WALLETS)
|
||||||
.apply()
|
})
|
||||||
.da()
|
.da_with(|da| {
|
||||||
.channel_rate(1)
|
da.channel_rate(1)
|
||||||
.blob_rate(1)
|
.blob_rate(1)
|
||||||
.apply()
|
})
|
||||||
.with_run_duration(run_duration)
|
.with_run_duration(run_duration)
|
||||||
.expect_consensus_liveness()
|
.expect_consensus_liveness()
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@ -35,8 +35,18 @@ non_zero_rate_fn!(blob_rate_checked, "blob rate must be non-zero");
|
|||||||
pub trait ScenarioBuilderExt<Caps>: Sized {
|
pub trait ScenarioBuilderExt<Caps>: Sized {
|
||||||
/// Configure a transaction flow workload.
|
/// Configure a transaction flow workload.
|
||||||
fn transactions(self) -> TransactionFlowBuilder<Caps>;
|
fn transactions(self) -> TransactionFlowBuilder<Caps>;
|
||||||
|
/// Configure a transaction flow workload via closure.
|
||||||
|
fn transactions_with(
|
||||||
|
self,
|
||||||
|
f: impl FnOnce(TransactionFlowBuilder<Caps>) -> TransactionFlowBuilder<Caps>,
|
||||||
|
) -> CoreScenarioBuilder<Caps>;
|
||||||
/// Configure a data-availability workload.
|
/// Configure a data-availability workload.
|
||||||
fn da(self) -> DataAvailabilityFlowBuilder<Caps>;
|
fn da(self) -> DataAvailabilityFlowBuilder<Caps>;
|
||||||
|
/// Configure a data-availability workload via closure.
|
||||||
|
fn da_with(
|
||||||
|
self,
|
||||||
|
f: impl FnOnce(DataAvailabilityFlowBuilder<Caps>) -> DataAvailabilityFlowBuilder<Caps>,
|
||||||
|
) -> CoreScenarioBuilder<Caps>;
|
||||||
#[must_use]
|
#[must_use]
|
||||||
/// Attach a consensus liveness expectation.
|
/// Attach a consensus liveness expectation.
|
||||||
fn expect_consensus_liveness(self) -> Self;
|
fn expect_consensus_liveness(self) -> Self;
|
||||||
@ -50,10 +60,24 @@ impl<Caps> ScenarioBuilderExt<Caps> for CoreScenarioBuilder<Caps> {
|
|||||||
TransactionFlowBuilder::new(self)
|
TransactionFlowBuilder::new(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn transactions_with(
|
||||||
|
self,
|
||||||
|
f: impl FnOnce(TransactionFlowBuilder<Caps>) -> TransactionFlowBuilder<Caps>,
|
||||||
|
) -> CoreScenarioBuilder<Caps> {
|
||||||
|
f(self.transactions()).apply()
|
||||||
|
}
|
||||||
|
|
||||||
fn da(self) -> DataAvailabilityFlowBuilder<Caps> {
|
fn da(self) -> DataAvailabilityFlowBuilder<Caps> {
|
||||||
DataAvailabilityFlowBuilder::new(self)
|
DataAvailabilityFlowBuilder::new(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn da_with(
|
||||||
|
self,
|
||||||
|
f: impl FnOnce(DataAvailabilityFlowBuilder<Caps>) -> DataAvailabilityFlowBuilder<Caps>,
|
||||||
|
) -> CoreScenarioBuilder<Caps> {
|
||||||
|
f(self.da()).apply()
|
||||||
|
}
|
||||||
|
|
||||||
fn expect_consensus_liveness(self) -> Self {
|
fn expect_consensus_liveness(self) -> Self {
|
||||||
self.with_expectation(ConsensusLiveness::default())
|
self.with_expectation(ConsensusLiveness::default())
|
||||||
}
|
}
|
||||||
@ -185,12 +209,24 @@ impl<Caps> DataAvailabilityFlowBuilder<Caps> {
|
|||||||
pub trait ChaosBuilderExt: Sized {
|
pub trait ChaosBuilderExt: Sized {
|
||||||
/// Entry point into chaos workloads.
|
/// Entry point into chaos workloads.
|
||||||
fn chaos(self) -> ChaosBuilder;
|
fn chaos(self) -> ChaosBuilder;
|
||||||
|
/// Configure chaos via closure.
|
||||||
|
fn chaos_with(
|
||||||
|
self,
|
||||||
|
f: impl FnOnce(ChaosBuilder) -> CoreScenarioBuilder<NodeControlCapability>,
|
||||||
|
) -> CoreScenarioBuilder<NodeControlCapability>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChaosBuilderExt for CoreScenarioBuilder<NodeControlCapability> {
|
impl ChaosBuilderExt for CoreScenarioBuilder<NodeControlCapability> {
|
||||||
fn chaos(self) -> ChaosBuilder {
|
fn chaos(self) -> ChaosBuilder {
|
||||||
ChaosBuilder { builder: self }
|
ChaosBuilder { builder: self }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn chaos_with(
|
||||||
|
self,
|
||||||
|
f: impl FnOnce(ChaosBuilder) -> CoreScenarioBuilder<NodeControlCapability>,
|
||||||
|
) -> CoreScenarioBuilder<NodeControlCapability> {
|
||||||
|
f(self.chaos())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Chaos workload builder root.
|
/// Chaos workload builder root.
|
||||||
@ -202,6 +238,12 @@ pub struct ChaosBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ChaosBuilder {
|
impl ChaosBuilder {
|
||||||
|
/// Finish without adding a chaos workload.
|
||||||
|
#[must_use]
|
||||||
|
pub fn apply(self) -> CoreScenarioBuilder<NodeControlCapability> {
|
||||||
|
self.builder
|
||||||
|
}
|
||||||
|
|
||||||
/// Configure a random restarts chaos workload.
|
/// Configure a random restarts chaos workload.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn restart(self) -> ChaosRestartBuilder {
|
pub fn restart(self) -> ChaosRestartBuilder {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user