Documentation
¶
Overview ¶
Package testutils contains testing helpers.
Index ¶
Constants ¶
const DefaultChanBufferSize = 1
DefaultChanBufferSize is the default buffer size of the underlying channel.
Variables ¶
This section is empty.
Functions ¶
func StatusErrEqual ¶
StatusErrEqual returns true iff both err1 and err2 wrap status.Status errors and their underlying status protos are equal.
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel wraps a generic channel and provides a timed receive operation.
func NewChannelWithSize ¶
NewChannelWithSize returns a new Channel with a buffer of bufSize.
func (*Channel) Receive ¶
Receive returns the value received on the underlying channel, or the error returned by ctx if it is closed or cancelled.
func (*Channel) Replace ¶
func (cwt *Channel) Replace(value interface{})
Replace clears the value on the underlying channel, and sends the new value.
It's expected to be used with a size-1 channel, to only keep the most up-to-date item. This method is inherently racy when invoked concurrently from multiple goroutines.
type PipeListener ¶
type PipeListener struct {
// contains filtered or unexported fields
}
PipeListener is a listener with an unbuffered pipe. Each write will complete only once the other side reads. It should only be created using NewPipeListener.
func NewPipeListener ¶
func NewPipeListener() *PipeListener
NewPipeListener creates a new pipe listener.