package testutils
import "google.golang.org/grpc/internal/testutils"
Package testutils contains testing helpers.
Index ¶
- Constants
- Variables
- func StatusErrEqual(err1, err2 error) bool
- type Channel
- func NewChannel() *Channel
- func NewChannelWithSize(bufSize int) *Channel
- func (cwt *Channel) Receive() (interface{}, error)
- func (cwt *Channel) Send(value interface{})
- type PipeListener
Constants ¶
const ( // DefaultChanRecvTimeout is the default timeout for receive operations on the // underlying channel. DefaultChanRecvTimeout = 1 * time.Second // DefaultChanBufferSize is the default buffer size of the underlying channel. DefaultChanBufferSize = 1 )
Variables ¶
ErrRecvTimeout is an error to indicate that a receive operation on the channel timed out.
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 NewChannel ¶
func NewChannel() *Channel
NewChannel returns a new Channel.
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 ErrRecvTimeout if DefaultChanRecvTimeout amount of time elapses.
func (*Channel) Send ¶
func (cwt *Channel) Send(value interface{})
Send sends value on the underlying channel.
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.
func (*PipeListener) Accept ¶
func (p *PipeListener) Accept() (net.Conn, error)
Accept accepts a connection.
func (*PipeListener) Addr ¶
func (p *PipeListener) Addr() net.Addr
Addr returns a pipe addr.
func (*PipeListener) Close ¶
func (p *PipeListener) Close() error
Close closes the listener.
func (*PipeListener) Dialer ¶
Dialer dials a connection.
Source Files ¶
channel.go pipe_listener.go status_equal.go
- Version
- v1.31.0-dev
- Published
- Jun 11, 2020
- Platform
- darwin/amd64
- Imports
- 5 packages
- Last checked
- 28 minutes ago –
Tools for package owners.