Documentation ¶
Overview ¶
Package testutil provides shared utilities for testing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BufferedPipe ¶
BufferedPipe is like net.Pipe(), but with internal buffering on writes. In practice, our connections are generally TCP connections, for which writes will not block.
Buffered writes may not be fully flushed to the peer when this connection is closed. Thus this pipe may not be suitable for tests which require strict adherence to the net.Conn contract.
Should probably be replaced with the standard library implementation if this happens: https://github.com/golang/go/issues/34502
Types ¶
type SafeTestLogger ¶
SafeTestLogger allows concurrent goroutines to safely log to a testing.T instance.
func NewSafeLogger ¶
func NewSafeLogger(t *testing.T) *SafeTestLogger
NewSafeLogger wraps the testing.T instance in a SafeTestLogger.
func (*SafeTestLogger) Logf ¶
func (l *SafeTestLogger) Logf(format string, a ...interface{})
Logf safely logs to the wrapped testing.T instance.
type TLSOrigin ¶
TLSOrigin serves as a TLS origin, useful for proxying handshakes. Closes when the test completes.
func StartOrigin ¶
StartOrigin starts a TLSOrigin. There is no need to call Close on the returned origin.
func (*TLSOrigin) DialContext ¶
DialContext dials the origin.