Expand description
Multi-node mesh test fixtures (WEFT-112). Available outside cfg(test) so
downstream crates and integration tests can construct in-memory meshes.
Multi-node mesh test fixtures (WEFT-112).
Provides in-process transport and peer mocks so K6 integration tests do not need real TCP/QUIC sockets.
§Fixtures
| Type | Role |
|---|---|
InMemoryTransport | MeshTransport over tokio channels (mem:// URLs) |
FaultyTransport | Wraps in-memory transport with drop/fail injection |
MockPeer | Lightweight simulated mesh node with inbox |
MockClock | Deterministic clock (re-export of crate::mesh_clock::MockClock) |
§Downstream authors
ⓘ
use clawft_kernel::mesh_test_support::{
connected_pair, FaultyTransport, InMemoryTransport, MockClock, MockPeer,
};
#[tokio::test]
async fn two_node_exchange() {
let (mut a, mut b) = connected_pair().await.unwrap();
a.send(b"hello").await.unwrap();
assert_eq!(b.recv().await.unwrap(), b"hello");
}Prefer mem://node-a style addresses. Share one
InMemoryTransport (or clone via InMemoryTransport::clone)
across peers so listen/connect meet in the same registry.
Re-exports§
pub use crate::mesh_clock::Clock;pub use crate::mesh_clock::MockClock;pub use crate::mesh_clock::RealClock;
Structs§
- Faulty
Transport - Fault-injection wrapper around
InMemoryTransport. - InMemory
Listener - Listener that yields accepted in-memory streams.
- InMemory
Stream - Bidirectional in-memory byte stream (tokio channels).
- InMemory
Transport - Shared registry for in-memory
mem://endpoints. - Mock
Peer - Lightweight simulated mesh node for multi-node tests.
Functions§
- connected_
pair - Create a connected pair of in-memory streams (no peers).
- two_
node_ streams - Two mock peers sharing a fabric, with an established stream pair.