grpc: google.golang.org/grpc/xds/internal/testutils Index | Files | Directories

package testutils

import "google.golang.org/grpc/xds/internal/testutils"

Package testutils provides utility types, for use in xds tests.

Index

Package Files

channel.go

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

var ErrRecvTimeout = errors.New("timed out when waiting for value on channel")

ErrRecvTimeout is an error to indicate that a receive operation on the channel timed out.

type Channel Uses

type Channel struct {
    // contains filtered or unexported fields
}

Channel wraps a generic channel and provides a timed receive operation.

func NewChannel Uses

func NewChannel() *Channel

NewChannel returns a new Channel.

func NewChannelWithSize Uses

func NewChannelWithSize(bufSize int) *Channel

NewChannelWithSize returns a new Channel with a buffer of bufSize.

func (*Channel) Receive Uses

func (cwt *Channel) Receive() (interface{}, error)

Receive returns the value received on the underlying channel, or ErrRecvTimeout if DefaultChanRecvTimeout amount of time elapses.

func (*Channel) Send Uses

func (cwt *Channel) Send(value interface{})

Send sends value on the underlying channel.

func (*Channel) TimedReceive Uses

func (cwt *Channel) TimedReceive(timeout time.Duration) (interface{}, error)

TimedReceive returns the value received on the underlying channel, or ErrRecvTimeout if timeout amount of time elapsed.

Directories

PathSynopsis
fakeclientPackage fakeclient provides a fake implementation of an xDS client.
fakeserverPackage fakeserver provides a fake implementation of an xDS server.

Package testutils imports 2 packages (graph) and is imported by 2 packages. Updated 2019-12-28. Refresh now. Tools for package owners.