Trait network::testutils::test_node::TestNode[][src]

pub trait TestNode: ApplicationNode + Sync {
    fn peer_network_id(&self, network_id: NetworkId) -> PeerNetworkId { ... }
fn network_ids(&self) -> Vec<NetworkId> { ... }
fn connect(&self, network_id: NetworkId, metadata: ConnectionMetadata) { ... }
fn connect_self(&self, network_id: NetworkId, metadata: ConnectionMetadata) { ... }
fn disconnect(&self, network_id: NetworkId, metadata: ConnectionMetadata) { ... }
fn disconnect_self(
        &self,
        network_id: NetworkId,
        metadata: ConnectionMetadata
    ) { ... }
fn find_common_network(&self, other: &Self) -> Option<NetworkId> { ... }
fn conn_metadata(
        &self,
        network_id: NetworkId,
        origin: ConnectionOrigin,
        protocol_ids: &[ProtocolId]
    ) -> ConnectionMetadata { ... }
fn get_next_network_msg<'life0, 'async_trait>(
        &'life0 mut self,
        network_id: NetworkId
    ) -> Pin<Box<dyn Future<Output = PeerManagerRequest> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: Send + 'async_trait
, { ... }
fn wait_for_no_msg<'life0, 'async_trait>(
        &'life0 mut self,
        network_id: NetworkId,
        timeout: Duration
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: Send + 'async_trait
, { ... }
fn drop_next_network_msg<'life0, 'async_trait>(
        &'life0 mut self,
        network_id: NetworkId
    ) -> Pin<Box<dyn Future<Output = (PeerId, ProtocolId, Bytes)> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: Send + 'async_trait
, { ... }
fn send_next_network_msg<'life0, 'async_trait>(
        &'life0 mut self,
        network_id: NetworkId
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: Send + 'async_trait
, { ... } }
Expand description

An extension trait for an ApplicationNode to run tests on.

Handles common implementation and helper functions

Provided methods

Retrieve the PeerNetworkId for a specific NetworkId.

There can only be one per network.

Retrieve all NetworkId for the node

Connects a node to another node. The other’s inbound handle must already be added.

Connects only the local side, useful for mocking the other node

Disconnects a node from another node

Disconnects only the local side, useful for mocking the other node

Find a common NetworkId between nodes based on NodeType

Build ConnectionMetadata for a connection on another node

Gets the next queued network message on Node’s network NetworkId. Doesn’t propagate to downstream node. If dropping a message use TestNode::drop_next_network_msg

Confirms no message is sent in the period of time

Drop a network message. This is required over [TestNode::get_network_msg] because the oneshot channel must be dropped.

Sends the next queued network message on Node’s network (NetworkId)

Implementors