mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-02-17 03:33:08 +00:00
This merge brings the following updates from the dev branch: Pull Requests: - #10: chore: update main repo dependencies (@hansieodendaal) Update for main repo changes including removal of DA config-related code and executor node dependencies - #8: Add support to use framework without running scenario (@andrussal) Add ManualCluster for controlling nodes lifecycle and reorganize node-control logic - #7: Remove DA (@andrussal) Remove DA workload usage from framework following node changes - #6: feat: refactor for using external cucumber (@hansieodendaal) Removed all references to cucumber and prepared compose docker workspace for external repo root - #4: Individual nodes connect at runtime (@andrussal) Add option to connect to arbitrary peers when starting a node - #2: feat: add cucumber auto deployer (@hansieodendaal) Added example for selecting deployer based on environment variable - #1: chore: allow older curl versions as well (@hansieodendaal) Allow compatibility with older and newer curl versions Contributors: - @andrussal - @hansieodendaal
73 lines
2.1 KiB
Rust
73 lines
2.1 KiB
Rust
use std::time::Duration;
|
|
|
|
use anyhow::Result;
|
|
use testing_framework_core::{
|
|
scenario::{PeerSelection, StartNodeOptions},
|
|
topology::config::TopologyConfig,
|
|
};
|
|
use testing_framework_runner_local::LocalDeployer;
|
|
use tokio::time::sleep;
|
|
use tracing_subscriber::fmt::try_init;
|
|
|
|
const MAX_HEIGHT_DIFF: u64 = 5;
|
|
|
|
#[tokio::test]
|
|
#[ignore = "run manually with `cargo test -p runner-examples -- --ignored manual_cluster_two_clusters_merge`"]
|
|
async fn manual_cluster_two_clusters_merge() -> Result<()> {
|
|
let _ = try_init();
|
|
// Required env vars (set on the command line when running this test):
|
|
// - `POL_PROOF_DEV_MODE=true`
|
|
// - `RUST_LOG=info` (optional)
|
|
let config = TopologyConfig::with_node_numbers(2);
|
|
let deployer = LocalDeployer::new();
|
|
let cluster = deployer.manual_cluster(config)?;
|
|
// Nodes are stopped automatically when the cluster is dropped.
|
|
|
|
println!("starting validator a");
|
|
|
|
let validator_a = cluster
|
|
.start_validator_with(
|
|
"a",
|
|
StartNodeOptions {
|
|
peers: PeerSelection::None,
|
|
},
|
|
)
|
|
.await?
|
|
.api;
|
|
|
|
println!("waiting briefly before starting c");
|
|
sleep(Duration::from_secs(30)).await;
|
|
|
|
println!("starting validator c -> a");
|
|
let validator_c = cluster
|
|
.start_validator_with(
|
|
"c",
|
|
StartNodeOptions {
|
|
peers: PeerSelection::Named(vec!["validator-a".to_owned()]),
|
|
},
|
|
)
|
|
.await?
|
|
.api;
|
|
|
|
println!("waiting for network readiness: cluster a,c");
|
|
cluster.wait_network_ready().await?;
|
|
|
|
sleep(Duration::from_secs(5)).await;
|
|
|
|
let a_info = validator_a.consensus_info().await?;
|
|
let c_info = validator_c.consensus_info().await?;
|
|
let height_diff = a_info.height.abs_diff(c_info.height);
|
|
|
|
println!(
|
|
"final heights: validator-a={}, validator-c={}, diff={}",
|
|
a_info.height, c_info.height, height_diff
|
|
);
|
|
|
|
if height_diff > MAX_HEIGHT_DIFF {
|
|
return Err(anyhow::anyhow!(
|
|
"height diff too large: {height_diff} > {MAX_HEIGHT_DIFF}"
|
|
));
|
|
}
|
|
Ok(())
|
|
}
|