package testutils
import "google.golang.org/grpc/xds/internal/testutils"
Package testutils provides utility types, for use in xds tests.
Index ¶
- Constants
- Variables
- type Channel
- func NewChannel() *Channel
- func NewChannelWithSize(bufSize int) *Channel
- func (cwt *Channel) Receive() (interface{}, error)
- func (cwt *Channel) Send(value interface{})
- func (cwt *Channel) TimedReceive(timeout time.Duration) (interface{}, error)
- type XDSClient
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.
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.
func (*Channel) TimedReceive ¶
TimedReceive returns the value received on the underlying channel, or ErrRecvTimeout if timeout amount of time elapsed.
type XDSClient ¶
type XDSClient struct {
// contains filtered or unexported fields
}
XDSClient is a fake implementation of an xds client. It exposes a bunch of channels to signal the occurrence of various events.
func NewXDSClient ¶
func NewXDSClient() *XDSClient
NewXDSClient returns a new fake xds client.
func (*XDSClient) Close ¶
func (xdsC *XDSClient) Close()
Close closes the xds client.
func (*XDSClient) InvokeWatchServiceCb ¶
InvokeWatchServiceCb invokes the registered service watch callback.
func (*XDSClient) WaitForWatchService ¶
WaitForWatchService waits for WatchService to be invoked on this client within a reasonable timeout.
func (*XDSClient) WatchService ¶
func (xdsC *XDSClient) WatchService(target string, callback func(xdsclient.ServiceUpdate, error)) func()
WatchService registers a LDS/RDS watch.
Source Files ¶
channel.go xdsclient.go
Directories ¶
Path | Synopsis |
---|---|
xds/internal/testutils/fakexds | Package fakexds provides fake implementation of multiple types, for use in xds tests. |
- Version
- v1.26.0
- Published
- Dec 17, 2019
- Platform
- windows/amd64
- Imports
- 3 packages
- Last checked
- 35 minutes ago –
Tools for package owners.