Documentation
¶
Overview ¶
Package testutils contains testing helpers for xDS and LRS clients.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Channel ¶
type Channel struct {
// C is the underlying channel on which values sent using the SendXxx()
// methods are delivered. Tests which cannot use ReceiveXxx() for whatever
// reasons can use C to read the values.
C chan any
}
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) Drain ¶ added in v1.74.0
func (c *Channel) Drain()
Drain drains the channel by repeatedly reading from it until it is empty.
func (*Channel) Receive ¶ added in v1.73.0
Receive returns the value received on the underlying channel, or the error returned by ctx if it is closed or cancelled.
func (*Channel) Replace ¶ added in v1.73.0
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 ConnWrapper ¶ added in v1.73.0
ConnWrapper wraps a net.Conn and pushes on a channel when closed.
func (*ConnWrapper) Close ¶ added in v1.73.0
func (cw *ConnWrapper) Close() error
Close closes the connection and sends a value on the close channel.
type ListenerWrapper ¶ added in v1.73.0
ListenerWrapper wraps a net.Listener and the returned net.Conn.
It pushes on a channel whenever it accepts a new connection.
func NewListenerWrapper ¶ added in v1.73.0
func NewListenerWrapper(t *testing.T, lis net.Listener) *ListenerWrapper
NewListenerWrapper returns a ListenerWrapper.
type RestartableListener ¶
type RestartableListener struct {
// contains filtered or unexported fields
}
RestartableListener wraps a net.Listener and supports stopping and restarting the latter.
func NewRestartableListener ¶
func NewRestartableListener(l net.Listener) *RestartableListener
NewRestartableListener returns a new RestartableListener wrapping l.
func (*RestartableListener) Accept ¶
func (l *RestartableListener) Accept() (net.Conn, error)
Accept waits for and returns the next connection to the listener.
If the listener is currently not accepting new connections, because `Stop` was called on it, the connection is immediately closed after accepting without any bytes being sent on it.
func (*RestartableListener) Addr ¶
func (l *RestartableListener) Addr() net.Addr
Addr returns the listener's network address.
func (*RestartableListener) Close ¶
func (l *RestartableListener) Close() error
Close closes the listener.
func (*RestartableListener) Restart ¶
func (l *RestartableListener) Restart()
Restart gets a previously stopped listener to start accepting connections.
func (*RestartableListener) Stop ¶
func (l *RestartableListener) Stop()
Stop closes existing connections on the listener and prevents new connections from being accepted.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package e2e provides utilities for end2end testing of xDS and LRS clients functionalities.
|
Package e2e provides utilities for end2end testing of xDS and LRS clients functionalities. |
|
Package fakeserver provides a fake implementation of the management server.
|
Package fakeserver provides a fake implementation of the management server. |