TestNetwork

Struct TestNetwork 

Source
pub struct TestNetwork { /* private fields */ }
Expand description

A test network consisting of gateways and peer nodes

Implementations§

Source§

impl TestNetwork

Source

pub fn log_files(&self) -> Vec<(String, PathBuf)>

Get all log files from the network

Source

pub fn read_logs(&self) -> Result<Vec<LogEntry>>

Read all logs in chronological order

For Docker containers, this fetches logs from the Docker API and caches them. For local processes, this reads directly from log files.

Source

pub fn tail_logs(&self) -> Result<impl Iterator<Item = LogEntry> + '_>

Tail logs from all peers (blocking)

Source§

impl TestNetwork

Source

pub fn builder() -> NetworkBuilder

Create a new network builder

Source

pub fn gateway(&self, index: usize) -> &TestPeer

Get a gateway peer by index

Source

pub fn peer(&self, index: usize) -> &TestPeer

Get a non-gateway peer by index

Source

pub fn gateway_ws_urls(&self) -> Vec<String>

Get all gateway WebSocket URLs

Source

pub fn peer_ws_urls(&self) -> Vec<String>

Get all peer WebSocket URLs

Source

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.

Source

pub async fn wait_until_ready_with_timeout( &self, timeout: Duration, ) -> Result<()>

Wait until the network is ready with a custom timeout

Source

pub async fn check_connectivity_detailed(&self) -> ConnectivityStatus

Check current network connectivity with detailed status

Source

pub async fn topology(&self) -> Result<NetworkTopology>

Get the current network topology

Source

pub fn export_for_viz(&self) -> String

Export network information in JSON format for visualization tools

Source

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.

Source

pub async fn ring_snapshot(&self) -> Result<Vec<RingPeerSnapshot>>

Collect per-peer ring data (locations + adjacency) for visualization/debugging.

Source

pub async fn write_ring_visualization<P: AsRef<Path>>( &self, output_path: P, ) -> Result<()>

Generate an interactive HTML ring visualization for the current network.

Source

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.

Source§

impl TestNetwork

Source

pub fn run_root(&self) -> &Path

Directory containing all peer state/logs for this test network run.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more