Expand description
MockDaemon — the daemon side of §7.3, in this process.
Blueprint §9.1 lists init_testing (in-process daemon for unit tests) as
part of the node API’s surface. This is that daemon. It is not a stub:
it speaks the real greeting (§7.2), the real NodeRequest/NodeEvent
families (§7.3), over the real frame codec (§7.1), on both ends of a
tokio::io::duplex pair. A node under test cannot tell it from a socket,
which is the entire point — a test that passes here is a test of the code
that ships.
Node ──► real greeting ──► real frames ──► MockDaemon
│
routing table from the specs
│
another Node ◄── real NodeEvent frames ◄───────┘§What it does
| Request | Answer |
|---|---|
Register | Registered { spec, session } |
Subscribe | Recorded; inputs start flowing |
SendMessage | Recorded, and routed to every consumer whose InputSpec::source names that port |
OutputDone / CloseOutputs | InputClosed to those consumers |
ExtStore / ExtLoad / ExtDrop | An in-memory extension table; ExtLoad answers ExtValue |
RouteUpgradeAck | Recorded, so a test can assert the §6.3 handshake completed |
The routing is what makes a two-node test possible: connect a producer
and a consumer whose input names the producer’s port, and a send on one
arrives as an Event::Input on the other, through the wire, exactly as it
would through a daemon.
Structs§
- Mock
Daemon - An in-process daemon for unit tests.
- Recorded
Request - One request the daemon received, with the node it came from.
- Recorded
Send - One message a node published.
- Unix
Endpoint Unix - A listening Unix-domain socket, unlinked when it is dropped.
Constants§
- DUPLEX_
BUFFER - The duplex buffer each mock connection gets.
- HANDSHAKE_
TIMEOUT - How long the mock greeting is allowed to take.