Documentation
¶
Overview ¶
Package rpctest runs an app's RPC server on a temporary private socket for tests: the transport an app's own rpctest builds on. The app's rpctest builds its engine and services, lets a test replace any domain (Options.Services, frostmail's form), builds its router, and serves it with Serve; tests then dial the socket, or Pipe a connection served as another caller.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options[S any] struct { // Services, when set, edits the services before the router is built, // so a test can replace any domain with a fake. Services func(*S) }
Options are what every app's rpctest options hold, with S the app's api.Services. An app embeds them in its own.
type Run ¶
type Run struct {
// Socket is the server's private socket.
Socket string
// contains filtered or unexported fields
}
Run is a server under test.
func Serve ¶
Serve listens on a fresh private socket (jsonrpc.Listen) and runs serve on it until the test ends or Stop. A serve that fails, or that does not return within 5 s of being stopped, fails the test. Off Linux, where jsonrpc.Listen serves no private socket, it skips the test.