Documentation ¶
Overview ¶
Package testlib provides common test utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DumbCourier = dumbCourier{}
DumbCourier always succeeds delivery, and ignores everything.
Functions ¶
func GenerateCert ¶
GenerateCert generates a new, INSECURE self-signed certificate and writes it to a pair of (cert.pem, key.pem) files to the given path. Note the certificate is only useful for testing purposes.
func GetFreePort ¶
func GetFreePort() string
GetFreePort returns a free TCP port. This is hacky and not race-free, but it works well enough for testing purposes.
func MustTempDir ¶
MustTempDir creates a temporary directory, or dies trying.
func RemoveIfOk ¶
RemoveIfOk removes the given directory, but only if we have not failed. We want to keep the failed directories for debugging.
Types ¶
type TestCourier ¶
type TestCourier struct { Requests []*deliverRequest ReqFor map[string]*deliverRequest sync.Mutex // contains filtered or unexported fields }
TestCourier never fails, and always remembers everything.
func NewTestCourier ¶
func NewTestCourier() *TestCourier
NewTestCourier returns a new, empty TestCourier instance.