pub struct TestNetwork { /* private fields */ }Expand description
A test network consisting of gateways and peer nodes
Implementations§
Source§impl TestNetwork
impl TestNetwork
Source§impl TestNetwork
impl TestNetwork
Sourcepub fn builder() -> NetworkBuilder
pub fn builder() -> NetworkBuilder
Create a new network builder
Sourcepub fn gateway_ws_urls(&self) -> Vec<String>
pub fn gateway_ws_urls(&self) -> Vec<String>
Get all gateway WebSocket URLs
Sourcepub fn peer_ws_urls(&self) -> Vec<String>
pub fn peer_ws_urls(&self) -> Vec<String>
Get all peer WebSocket URLs
Sourcepub async fn wait_until_ready(&self) -> Result<()>
pub async fn wait_until_ready(&self) -> Result<()>
Wait until the network is ready for use
This checks that peers have formed connections and the network is sufficiently connected for testing.
Sourcepub async fn wait_until_ready_with_timeout(
&self,
timeout: Duration,
) -> Result<()>
pub async fn wait_until_ready_with_timeout( &self, timeout: Duration, ) -> Result<()>
Wait until the network is ready with a custom timeout
Sourcepub async fn check_connectivity_detailed(&self) -> ConnectivityStatus
pub async fn check_connectivity_detailed(&self) -> ConnectivityStatus
Check current network connectivity with detailed status
Sourcepub async fn topology(&self) -> Result<NetworkTopology>
pub async fn topology(&self) -> Result<NetworkTopology>
Get the current network topology
Sourcepub fn export_for_viz(&self) -> String
pub fn export_for_viz(&self) -> String
Export network information in JSON format for visualization tools
Sourcepub async fn collect_diagnostics(&self) -> Result<NetworkDiagnosticsSnapshot>
pub async fn collect_diagnostics(&self) -> Result<NetworkDiagnosticsSnapshot>
Collect diagnostics from every peer, returning a snapshot that can be serialized to JSON for offline analysis.
Sourcepub async fn ring_snapshot(&self) -> Result<Vec<RingPeerSnapshot>>
pub async fn ring_snapshot(&self) -> Result<Vec<RingPeerSnapshot>>
Collect per-peer ring data (locations + adjacency) for visualization/debugging.
Sourcepub async fn write_ring_visualization<P: AsRef<Path>>(
&self,
output_path: P,
) -> Result<()>
pub async fn write_ring_visualization<P: AsRef<Path>>( &self, output_path: P, ) -> Result<()>
Generate an interactive HTML ring visualization for the current network.
Sourcepub async fn write_ring_visualization_for_contract<P: AsRef<Path>>(
&self,
output_path: P,
contract_id: &str,
) -> Result<()>
pub async fn write_ring_visualization_for_contract<P: AsRef<Path>>( &self, output_path: P, contract_id: &str, ) -> Result<()>
Generate an interactive HTML ring visualization for a specific contract.
Sourcepub fn dump_logs(&self, filter: Option<&str>)
pub fn dump_logs(&self, filter: Option<&str>)
Dump logs from all peers, optionally filtered by a pattern
If filter is Some, only logs containing the pattern (case-insensitive) are printed.
Logs are printed in chronological order with peer ID prefix.
This is useful for debugging test failures - call it before assertions or in error handlers.
Sourcepub fn dump_connection_logs(&self)
pub fn dump_connection_logs(&self)
Dump logs related to connection establishment and NAT traversal
Filters for: hole punch, NAT, connect, acceptor, joiner, handshake