Documentation
¶
Overview ¶
Package peercredtest gives a test a socket peer that is another process, with a pid and a lifetime of its own: what telling a peer from the test itself, or outliving it, needs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Main ¶
Main is Run for a TestMain with work of its own around the tests, such as testhome's isolation:
func TestMain(m *testing.M) {
os.Exit(testhome.Main(func() int { return peercredtest.Main(m.Run) }))
}
It calls run and returns its code, except in the process Start runs, where it is the peer: it connects to the test's socket, stays until its standard input closes, and returns the peer's exit code.
Types ¶
type Peer ¶
type Peer struct {
// Conn is the test's end of the connection the peer made.
Conn *net.UnixConn
// PID is the peer's process id.
PID int
// contains filtered or unexported fields
}
Peer is a process of its own connected to the test.
func Start ¶
Start runs the test binary again as a peer (Main) and returns once it has connected. The peer ends, and is reaped, with the test at the latest.