mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-10 00:26:59 +00:00
Add an in-process mixed-profile lifecycle test over loopback
Brings up a Full/Full/NonRouting/Leaf mesh matching the mixed-profile Docker topology, asserts each node peers to the degree its role and topology dictate (A=3, B=2, C=2, D=1), and verifies end-to-end data between every directly reachable pair (Full-Full, Full-NonRouting, Full-Leaf). Adds run_tree_test_with_profiles, a per-node-profile sibling of run_tree_test. The Leaf-to-Full multi-hop the Docker suite also checks is deliberately left out for now: a Leaf node's multi-hop session initiation on the XX line is not yet reliable, so the Docker mixed-profile suite is retained for that path rather than replaced with a flaky assertion.
This commit is contained in:
@@ -774,6 +774,47 @@ pub(super) async fn run_tree_test(
|
||||
nodes
|
||||
}
|
||||
|
||||
/// Like `run_tree_test` but with a per-node `NodeProfile`.
|
||||
///
|
||||
/// `profiles` must have one entry per node. Builds each node with the
|
||||
/// matching profile (Full / NonRouting / Leaf) over loopback, wires the
|
||||
/// edges, drains to convergence and asserts every edge established a
|
||||
/// bidirectional peer. Used by mixed-profile lifecycle tests where the
|
||||
/// node roles, not the topology shape, are the subject.
|
||||
pub(super) async fn run_tree_test_with_profiles(
|
||||
profiles: &[crate::proto::fmp::NodeProfile],
|
||||
edges: &[(usize, usize)],
|
||||
verbose: bool,
|
||||
) -> Vec<TestNode> {
|
||||
let mut nodes = Vec::with_capacity(profiles.len());
|
||||
for &profile in profiles {
|
||||
nodes.push(make_test_node_with_profile(profile).await);
|
||||
}
|
||||
|
||||
for &(i, j) in edges {
|
||||
initiate_handshake(&mut nodes, i, j).await;
|
||||
}
|
||||
|
||||
let total = drain_all_packets(&mut nodes, verbose).await;
|
||||
assert!(total > 0, "Should have processed at least some packets");
|
||||
repair_missing_edge_handshakes(&mut nodes, edges, verbose).await;
|
||||
|
||||
for &(i, j) in edges {
|
||||
let j_addr = *nodes[j].node.node_addr();
|
||||
let i_addr = *nodes[i].node.node_addr();
|
||||
assert!(
|
||||
nodes[i].node.get_peer(&j_addr).is_some(),
|
||||
"Node {i} should have peer {j_addr} (node {j})"
|
||||
);
|
||||
assert!(
|
||||
nodes[j].node.get_peer(&i_addr).is_some(),
|
||||
"Node {j} should have peer {i_addr} (node {i})"
|
||||
);
|
||||
}
|
||||
|
||||
nodes
|
||||
}
|
||||
|
||||
/// Like `run_tree_test` but with per-node transport MTUs.
|
||||
///
|
||||
/// `mtus` must have one entry per node. Used for heterogeneous-MTU tests
|
||||
|
||||
Reference in New Issue
Block a user