testutils
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package testutils contains testing helpers.
Index¶
- Constants
- Variables
- func AwaitNoStateChange(ctx context.Context, t *testing.T, sc StateChanger, ...)
- func AwaitNotState(ctx context.Context, t *testing.T, sc StateChanger, ...)
- func AwaitState(ctx context.Context, t *testing.T, sc StateChanger, ...)
- func CreateBootstrapFileForTesting(t *testing.T, bootstrapContents []byte)
- func CreateClientTLSCredentials(t *testing.T) credentials.TransportCredentials
- func CreateServerTLSCredentials(t *testing.T, clientAuth tls.ClientAuthType) credentials.TransportCredentials
- func CreateServerTLSCredentialsCompatibleWithSPIFFE(t *testing.T, clientAuth tls.ClientAuthType) credentials.TransportCredentials
- func CreateServerTLSCredentialsCompatibleWithSPIFFEChain(t *testing.T, clientAuth tls.ClientAuthType) credentials.TransportCredentials
- func CreateServerTLSCredentialsValidSPIFFEButWrongCA(t *testing.T, clientAuth tls.ClientAuthType) credentials.TransportCredentials
- func IsRoundRobin(want []balancer.SubConn, f func() balancer.SubConn) error
- func LocalTCPListener() (net.Listener, error)
- func MarshalAny(t *testing.T, m proto.Message) *anypb.Any
- func MustParseURL(target string) *url.URL
- func NewTestWRR() wrr.WRR
- func ParsePort(t *testing.T, addr string) uint32
- func SetEnvConfig[T any](t *testing.T, variable *T, value T)
- func StatusErrEqual(err1, err2 error) bool
- func StayConnected(ctx context.Context, sc StateChanger)
- func SubConnFromPicker(p balancer.Picker) func() balancer.SubConn
- type BalancerClientConn
- func (*BalancerClientConn) MetricsRecorder() stats.MetricsRecorder
- func (tcc *BalancerClientConn) NewSubConn(a []resolver.Address, o balancer.NewSubConnOptions) (balancer.SubConn, error)
- func (tcc *BalancerClientConn) RemoveSubConn(sc balancer.SubConn)
- func (tcc *BalancerClientConn) ResolveNow(o resolver.ResolveNowOptions)
- func (tcc *BalancerClientConn) Target() string
- func (tcc *BalancerClientConn) UpdateAddresses(sc balancer.SubConn, addrs []resolver.Address)
- func (tcc *BalancerClientConn) UpdateState(bs balancer.State)
- func (tcc *BalancerClientConn) WaitForConnectivityState(ctx context.Context, want connectivity.State) error
- func (tcc *BalancerClientConn) WaitForErrPicker(ctx context.Context) error
- func (tcc *BalancerClientConn) WaitForPicker(ctx context.Context, f func(balancer.Picker) error) error
- func (tcc *BalancerClientConn) WaitForPickerWithErr(ctx context.Context, want error) error
- func (tcc *BalancerClientConn) WaitForRoundRobinPicker(ctx context.Context, want ...balancer.SubConn) error
- type BlockingDialer
- type Channel
- func (c *Channel) Drain()
- func (c *Channel) Receive(ctx context.Context) (any, error)
- func (c *Channel) ReceiveOrFail() (any, bool)
- func (c *Channel) Replace(value any)
- func (c *Channel) Send(value any)
- func (c *Channel) SendContext(ctx context.Context, value any) error
- func (c *Channel) SendOrFail(value any) bool
- type ConnWrapper
- type FakeHTTPClient
- type Hold
- type ListenerWrapper
- type Logger
- type PipeListener
- type ResolverClientConn
- type RestartableListener
- type StateChanger
- type StubStatsHandler
- func (ssh *StubStatsHandler) HandleConn(ctx context.Context, cs stats.ConnStats)
- func (ssh *StubStatsHandler) HandleRPC(ctx context.Context, rs stats.RPCStats)
- func (ssh *StubStatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context
- func (ssh *StubStatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context
- type TestConstPicker
- type TestSubConn
- func (tsc *TestSubConn) Connect()
- func (tsc *TestSubConn) GetOrBuildProducer(balancer.ProducerBuilder) (balancer.Producer, func())
- func (tsc *TestSubConn) RegisterHealthListener(lis func(balancer.SubConnState))
- func (tsc *TestSubConn) Shutdown()
- func (tsc *TestSubConn) String() string
- func (tsc *TestSubConn) UpdateAddresses([]resolver.Address)
- func (tsc *TestSubConn) UpdateState(state balancer.SubConnState)
Constants¶
const DefaultChanBufferSize = 1DefaultChanBufferSize is the default buffer size of the underlying channel.
const DefaultHTTPRequestTimeout = 1 *time.SecondDefaultHTTPRequestTimeout is the default timeout value for the amount of timethis client waits for a response to be pushed on RespChan before it fails theDo() call.
Variables¶
var ErrTestConstPicker =fmt.Errorf("const picker error")ErrTestConstPicker is error returned by test const picker.
Functions¶
funcAwaitNoStateChange¶added inv1.58.0
func AwaitNoStateChange(ctxcontext.Context, t *testing.T, scStateChanger, currStateconnectivity.State)
AwaitNoStateChange expects ctx to be canceled before sc's state leavescurrState, and fatal errors otherwise.
funcAwaitNotState¶added inv1.58.0
func AwaitNotState(ctxcontext.Context, t *testing.T, scStateChanger, stateDoNotWantconnectivity.State)
AwaitNotState waits for sc to leave stateDoNotWant or fatal errors if itdoesn't happen before ctx expires.
funcAwaitState¶added inv1.58.0
func AwaitState(ctxcontext.Context, t *testing.T, scStateChanger, stateWantconnectivity.State)
AwaitState waits for sc to enter stateWant or fatal errors if it doesn'thappen before ctx expires.
funcCreateBootstrapFileForTesting¶added inv1.66.0
CreateBootstrapFileForTesting creates a temporary file with the providedbootstrap contents, and updates the bootstrap environment variable to pointto this file.
Registers a cleanup function on the provided testing.T, that deletes thetemporary file and resets the bootstrap environment variable.
funcCreateClientTLSCredentials¶added inv1.66.0
func CreateClientTLSCredentials(t *testing.T)credentials.TransportCredentials
CreateClientTLSCredentials creates client-side TLS transport credentialsusing certificate and key files from testdata/x509 directory.
funcCreateServerTLSCredentials¶added inv1.66.0
func CreateServerTLSCredentials(t *testing.T, clientAuthtls.ClientAuthType)credentials.TransportCredentials
CreateServerTLSCredentials creates server-side TLS transport credentialsusing certificate and key files from testdata/x509 directory.
funcCreateServerTLSCredentialsCompatibleWithSPIFFE¶added inv1.73.0
func CreateServerTLSCredentialsCompatibleWithSPIFFE(t *testing.T, clientAuthtls.ClientAuthType)credentials.TransportCredentials
CreateServerTLSCredentialsCompatibleWithSPIFFE creates server-side TLStransport credentials using certificate and key files from thetestdata/spiffe_end2end directory. These credentials are compatible with theSPIFFE trust bundles used on the client side.
funcCreateServerTLSCredentialsCompatibleWithSPIFFEChain¶added inv1.73.0
func CreateServerTLSCredentialsCompatibleWithSPIFFEChain(t *testing.T, clientAuthtls.ClientAuthType)credentials.TransportCredentials
CreateServerTLSCredentialsCompatibleWithSPIFFEChain creates server-side TLStransport credentials using a certificate chain and key files from thetestdata/spiffe_end2end directory. These credentials are compatible with theSPIFFE trust bundles used on the client side.
funcCreateServerTLSCredentialsValidSPIFFEButWrongCA¶added inv1.73.0
func CreateServerTLSCredentialsValidSPIFFEButWrongCA(t *testing.T, clientAuthtls.ClientAuthType)credentials.TransportCredentials
CreateServerTLSCredentialsValidSPIFFEButWrongCA creates server-side TLStransport credentials using certificate and key files from thetestdata/spiffe directory rather than the testdata/spiffe_end2end directory.These credentials have the expected trust domains and SPIFFE IDs that arecompatible with testdata/spiffe_end2end client files, but they are signed bya different CA and will thus fail the connection.
funcIsRoundRobin¶added inv1.43.0
IsRoundRobin checks whether f's return value is roundrobin of elements fromwant. But it doesn't check for the order. Note that want can containduplicate items, which makes it weight-round-robin.
Step 1. the return values of f should form a permutation of all elements inwant, but not necessary in the same order. E.g. if want is {a,a,b}, the checkfails if f returns:
- {a,a,a}: third a is returned before b
- {a,b,b}: second b is returned before the second a
If error is found in this step, the returned error contains only the firstiteration until where it goes wrong.
Step 2. the return values of f should be repetitions of the same permutation.E.g. if want is {a,a,b}, the check fails if f returns:
- {a,b,a,b,a,a}: though it satisfies step 1, the second iteration is notrepeating the first iteration.
If error is found in this step, the returned error contains the firstiteration + the second iteration until where it goes wrong.
funcLocalTCPListener¶added inv1.43.0
LocalTCPListener returns a net.Listener listening on local address and port.
funcMarshalAny¶added inv1.38.0
MarshalAny is a convenience function to marshal protobuf messages into anyprotos. function will fail the test with a fatal error if the marshaling fails.
funcMustParseURL¶added inv1.53.0
MustParseURL attempts to parse the provided target using url.Parse()and panics if parsing fails.
funcNewTestWRR¶added inv1.43.0
NewTestWRR return a WRR for testing. It's deterministic instead of random.
funcSetEnvConfig¶added inv1.72.0
SetEnvConfig sets the value of the given variable to the specified value,taking care of restoring the original value after the test completes.
funcStatusErrEqual¶added inv1.22.0
StatusErrEqual returns true iff both err1 and err2 wrap status.Status errorsand their underlying status protos are equal.
funcStayConnected¶added inv1.58.0
func StayConnected(ctxcontext.Context, scStateChanger)
StayConnected makes sc stay connected by repeatedly calling sc.Connect()until the state becomes Shutdown or until the context expires.
funcSubConnFromPicker¶added inv1.51.0
SubConnFromPicker returns a function which returns a SubConn by calling thePick() method of the provided picker. There is no caching of SubConns here.Every invocation of the returned function results in a new pick.
Types¶
typeBalancerClientConn¶added inv1.60.0
type BalancerClientConn struct {internal.EnforceClientConnEmbeddingNewSubConnAddrsCh chan []resolver.Address// the last 10 []Address to create subconn.NewSubConnCh chan *TestSubConn// the last 10 subconn created.ShutdownSubConnCh chan *TestSubConn// the last 10 subconn removed.UpdateAddressesAddrsCh chan []resolver.Address// last updated address via UpdateAddresses().NewPickerCh chanbalancer.Picker// the last picker updated.NewStateCh chanconnectivity.State// the last state.ResolveNowCh chanresolver.ResolveNowOptions// the last ResolveNow().// contains filtered or unexported fields}BalancerClientConn is a mock balancer.ClientConn used in tests.
funcNewBalancerClientConn¶added inv1.60.0
func NewBalancerClientConn(t *testing.T) *BalancerClientConn
NewBalancerClientConn creates a BalancerClientConn.
func (*BalancerClientConn)MetricsRecorder¶added inv1.71.0
func (*BalancerClientConn) MetricsRecorder()stats.MetricsRecorder
MetricsRecorder returns an empty MetricsRecorderList.
func (*BalancerClientConn)NewSubConn¶added inv1.60.0
func (tcc *BalancerClientConn) NewSubConn(a []resolver.Address, obalancer.NewSubConnOptions) (balancer.SubConn,error)
NewSubConn creates a new SubConn.
func (*BalancerClientConn)RemoveSubConn¶added inv1.60.0
func (tcc *BalancerClientConn) RemoveSubConn(scbalancer.SubConn)
RemoveSubConn is a nop; tests should all be updated to use sc.Shutdown()instead.
func (*BalancerClientConn)ResolveNow¶added inv1.60.0
func (tcc *BalancerClientConn) ResolveNow(oresolver.ResolveNowOptions)
ResolveNow panics.
func (*BalancerClientConn)Target¶added inv1.60.0
func (tcc *BalancerClientConn) Target()string
Target panics.
func (*BalancerClientConn)UpdateAddresses¶added inv1.60.0
func (tcc *BalancerClientConn) UpdateAddresses(scbalancer.SubConn, addrs []resolver.Address)
UpdateAddresses updates the addresses on the SubConn.
func (*BalancerClientConn)UpdateState¶added inv1.60.0
func (tcc *BalancerClientConn) UpdateState(bsbalancer.State)
UpdateState updates connectivity state and picker.
func (*BalancerClientConn)WaitForConnectivityState¶added inv1.60.0
func (tcc *BalancerClientConn) WaitForConnectivityState(ctxcontext.Context, wantconnectivity.State)error
WaitForConnectivityState waits until the state pushed to this ClientConnmatches the wanted state. Returns an error if the provided context expires,including the last received state (if any).
func (*BalancerClientConn)WaitForErrPicker¶added inv1.60.0
func (tcc *BalancerClientConn) WaitForErrPicker(ctxcontext.Context)error
WaitForErrPicker waits until an error picker is pushed to this ClientConn.Returns error if the provided context expires or a non-error picker is pushedto the ClientConn.
func (*BalancerClientConn)WaitForPicker¶added inv1.60.0
WaitForPicker waits for a picker that results in f returning nil. If thecontext expires, returns the last error returned by f (if any).
func (*BalancerClientConn)WaitForPickerWithErr¶added inv1.60.0
func (tcc *BalancerClientConn) WaitForPickerWithErr(ctxcontext.Context, wanterror)error
WaitForPickerWithErr waits until an error picker is pushed to thisClientConn with the error matching the wanted error. Returns an error ifthe provided context expires, including the last received picker error (ifany).
func (*BalancerClientConn)WaitForRoundRobinPicker¶added inv1.60.0
func (tcc *BalancerClientConn) WaitForRoundRobinPicker(ctxcontext.Context, want ...balancer.SubConn)error
WaitForRoundRobinPicker waits for a picker that passes IsRoundRobin. Alsodrains the matching state channel and requires it to be READY (if an entryis pending) to be considered. Returns an error if the provided contextexpires, including the last received error from IsRoundRobin or the picker(if any).
typeBlockingDialer¶added inv1.66.0
type BlockingDialer struct {// contains filtered or unexported fields}BlockingDialer is a dialer that waits for Resume() to be called beforedialing.
funcNewBlockingDialer¶added inv1.66.0
func NewBlockingDialer() *BlockingDialer
NewBlockingDialer returns a dialer that waits for Resume() to be calledbefore dialing.
func (*BlockingDialer)DialContext¶added inv1.66.0
DialContext implements a context dialer for use with grpc.WithContextDialerdial option for a BlockingDialer.
func (*BlockingDialer)Hold¶added inv1.66.0
func (d *BlockingDialer) Hold(addrstring) *Hold
Hold blocks the dialer when a connection attempt is made to the given addr.A hold is valid for exactly one connection attempt. Multiple holds for anaddr can be added, and they will apply in the order that the connections areattempted.
typeChannel¶added inv1.30.0
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 chanany}Channel wraps a generic channel and provides a timed receive operation.
funcNewChannelWithSize¶added inv1.30.0
NewChannelWithSize returns a new Channel with a buffer of bufSize.
func (*Channel)Drain¶added inv1.70.0
func (c *Channel) Drain()
Drain drains the channel by repeatedly reading from it until it is empty.
func (*Channel)Receive¶added inv1.30.0
Receive returns the value received on the underlying channel, or the errorreturned by ctx if it is closed or cancelled.
func (*Channel)ReceiveOrFail¶added inv1.34.0
ReceiveOrFail returns the value on the underlying channel and true, or niland false if the channel was empty.
func (*Channel)Replace¶added inv1.33.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 mostup-to-date item. This method is inherently racy when invoked concurrentlyfrom multiple goroutines.
func (*Channel)SendContext¶added inv1.34.0
SendContext sends value on the underlying channel, or returns an error ifthe context expires.
func (*Channel)SendOrFail¶added inv1.34.0
SendOrFail attempts to send value on the underlying channel. Returns trueif successful or false if the channel was full.
typeConnWrapper¶added inv1.46.0
ConnWrapper wraps a net.Conn and pushes on a channel when closed.
func (*ConnWrapper)Close¶added inv1.46.0
func (cw *ConnWrapper) Close()error
Close closes the connection and sends a value on the close channel.
typeFakeHTTPClient¶added inv1.33.0
type FakeHTTPClient struct {// ReqChan exposes the HTTP.Request made by the code under test.ReqChan *Channel// RespChan is a channel on which this fake client accepts responses to be// sent to the code under test.RespChan *Channel// Err, if set, is returned by Do().Errerror// RecvTimeout is the amount of the time this client waits for a response to// be pushed on RespChan before it fails the Do() call. If this field is// left unspecified, DefaultHTTPRequestTimeout is used.RecvTimeouttime.Duration}FakeHTTPClient helps mock out HTTP calls made by the code under test. Itmakes HTTP requests made by the code under test available through a channel,and makes it possible to inject various responses.
typeHold¶added inv1.66.0
type Hold struct {// contains filtered or unexported fields}Hold is a handle to a single connection attempt. It can be used to block,fail and succeed connection attempts.
func (*Hold)Fail¶added inv1.66.0
Fail fails the connection attempt. Either Resume or Fail must becalled at most once on a hold. Otherwise, Resume panics.
func (*Hold)IsStarted¶added inv1.67.0
IsStarted returns true if this hold has received a connection attempt.
typeListenerWrapper¶added inv1.46.0
ListenerWrapper wraps a net.Listener and the returned net.Conn.
It pushes on a channel whenever it accepts a new connection.
funcNewListenerWrapper¶added inv1.46.0
func NewListenerWrapper(t *testing.T, lisnet.Listener) *ListenerWrapper
NewListenerWrapper returns a ListenerWrapper.
typeLogger¶added inv1.60.0
type Logger interface {Log(args ...any)Logf(formatstring, args ...any)Errorf(formatstring, args ...any)}Logger wraps the logging methods from testing.T.
typePipeListener¶
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. Itshould only be created using NewPipeListener.
funcNewPipeListener¶
func NewPipeListener() *PipeListener
NewPipeListener creates a new pipe listener.
typeResolverClientConn¶added inv1.60.0
type ResolverClientConn struct {resolver.ClientConn// Embedding the interface to avoid implementing deprecated methods.LoggerLogger// Tests should pass testing.T for this.UpdateStateF func(resolver.State)error// Invoked when resolver pushes a state update.ReportErrorF func(errerror)// Invoked when resolver pushes an error.}ResolverClientConn is a fake implementation of the resolver.ClientConninterface to be used in tests.
func (*ResolverClientConn)ParseServiceConfig¶added inv1.60.0
func (t *ResolverClientConn) ParseServiceConfig(jsonSCstring) *serviceconfig.ParseResult
ParseServiceConfig parses the provided service by delegating the work to theimplementation in the grpc package.
func (*ResolverClientConn)ReportError¶added inv1.60.0
func (t *ResolverClientConn) ReportError(errerror)
ReportError pushes the error received from the resolver on to ErrorCh.
func (*ResolverClientConn)UpdateState¶added inv1.60.0
func (t *ResolverClientConn) UpdateState(sresolver.State)error
UpdateState invokes the test specified callback with the update received fromthe resolver. If the callback returns a non-nil error, the same will bepropagated to the resolver.
typeRestartableListener¶added inv1.43.0
type RestartableListener struct {// contains filtered or unexported fields}RestartableListener wraps a net.Listener and supports stopping and restartingthe latter.
funcNewRestartableListener¶added inv1.43.0
func NewRestartableListener(lnet.Listener) *RestartableListener
NewRestartableListener returns a new RestartableListener wrapping l.
func (*RestartableListener)Accept¶added inv1.43.0
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 acceptingwithout any bytes being sent on it.
func (*RestartableListener)Addr¶added inv1.43.0
func (l *RestartableListener) Addr()net.Addr
Addr returns the listener's network address.
func (*RestartableListener)Close¶added inv1.43.0
func (l *RestartableListener) Close()error
Close closes the listener.
func (*RestartableListener)Restart¶added inv1.43.0
func (l *RestartableListener) Restart()
Restart gets a previously stopped listener to start accepting connections.
func (*RestartableListener)Stop¶added inv1.43.0
func (l *RestartableListener) Stop()
Stop closes existing connections on the listener and prevents new connectionsfrom being accepted.
typeStateChanger¶added inv1.58.0
type StateChanger interface {// Connect begins connecting the StateChanger.Connect()// GetState returns the current state of the StateChanger.GetState()connectivity.State// WaitForStateChange returns true when the state becomes s, or returns// false if ctx is canceled first.WaitForStateChange(ctxcontext.Context, sconnectivity.State)bool}A StateChanger reports state changes, e.g. a grpc.ClientConn.
typeStubStatsHandler¶added inv1.60.0
type StubStatsHandler struct {TagRPCF func(ctxcontext.Context, info *stats.RPCTagInfo)context.ContextHandleRPCF func(ctxcontext.Context, infostats.RPCStats)TagConnF func(ctxcontext.Context, info *stats.ConnTagInfo)context.ContextHandleConnF func(ctxcontext.Context, infostats.ConnStats)}StubStatsHandler is a stats handler that is easy to customize withinindividual test cases. It is a stubbable implementation ofgoogle.golang.org/grpc/stats.Handler for testing purposes.
func (*StubStatsHandler)HandleConn¶added inv1.60.0
func (ssh *StubStatsHandler) HandleConn(ctxcontext.Context, csstats.ConnStats)
HandleConn calls the StubStatsHandler's HandleConnF, if set.
func (*StubStatsHandler)HandleRPC¶added inv1.60.0
func (ssh *StubStatsHandler) HandleRPC(ctxcontext.Context, rsstats.RPCStats)
HandleRPC calls the StubStatsHandler's HandleRPCF, if set.
func (*StubStatsHandler)TagConn¶added inv1.60.0
func (ssh *StubStatsHandler) TagConn(ctxcontext.Context, info *stats.ConnTagInfo)context.Context
TagConn calls the StubStatsHandler's TagConnF, if set.
func (*StubStatsHandler)TagRPC¶added inv1.60.0
func (ssh *StubStatsHandler) TagRPC(ctxcontext.Context, info *stats.RPCTagInfo)context.Context
TagRPC calls the StubStatsHandler's TagRPCF, if set.
typeTestConstPicker¶added inv1.43.0
TestConstPicker is a const picker for tests.
func (*TestConstPicker)Pick¶added inv1.43.0
func (tcp *TestConstPicker) Pick(balancer.PickInfo) (balancer.PickResult,error)
Pick returns the const SubConn or the error.
typeTestSubConn¶added inv1.43.0
type TestSubConn struct {balancer.SubConnConnectCh chan struct{}Addresses []resolver.Address// contains filtered or unexported fields}TestSubConn implements the SubConn interface, to be used in tests.
funcNewTestSubConn¶added inv1.58.0
func NewTestSubConn(idstring) *TestSubConn
NewTestSubConn returns a newly initialized SubConn. Typically, subconnsshould be created via TestClientConn.NewSubConn instead, but can be usefulfor some tests.
func (*TestSubConn)GetOrBuildProducer¶added inv1.51.0
func (tsc *TestSubConn) GetOrBuildProducer(balancer.ProducerBuilder) (balancer.Producer, func())
GetOrBuildProducer is a no-op.
func (*TestSubConn)RegisterHealthListener¶added inv1.69.0
func (tsc *TestSubConn) RegisterHealthListener(lis func(balancer.SubConnState))
RegisterHealthListener sends a READY update to mock a situation when nohealth checking mechanisms are configured.
func (*TestSubConn)Shutdown¶added inv1.58.0
func (tsc *TestSubConn) Shutdown()
Shutdown pushes the SubConn to the ShutdownSubConn channel in the parentTestClientConn.
func (*TestSubConn)String¶added inv1.43.0
func (tsc *TestSubConn) String()string
String implements stringer to print human friendly error message.
func (*TestSubConn)UpdateAddresses¶added inv1.43.0
func (tsc *TestSubConn) UpdateAddresses([]resolver.Address)
UpdateAddresses is a no-op.
func (*TestSubConn)UpdateState¶added inv1.58.0
func (tsc *TestSubConn) UpdateState(statebalancer.SubConnState)
UpdateState pushes the state to the listener, if one is registered.
Source Files¶
Directories¶
| Path | Synopsis |
|---|---|
Package fakegrpclb provides a fake implementation of the grpclb server. | Package fakegrpclb provides a fake implementation of the grpclb server. |
Package pickfirst contains helper functions to check for pickfirst load balancing of RPCs in tests. | Package pickfirst contains helper functions to check for pickfirst load balancing of RPCs in tests. |
Package proxyserver provides an implementation of a proxy server for testing purposes. | Package proxyserver provides an implementation of a proxy server for testing purposes. |
Package rls contains utilities for RouteLookupService e2e tests. | Package rls contains utilities for RouteLookupService e2e tests. |
Package roundrobin contains helper functions to check for roundrobin and weighted-roundrobin load balancing of RPCs in tests. | Package roundrobin contains helper functions to check for roundrobin and weighted-roundrobin load balancing of RPCs in tests. |
Package stats implements a TestMetricsRecorder utility. | Package stats implements a TestMetricsRecorder utility. |
xds | |
e2e Package e2e provides utilities for end2end testing of xDS functionality. | Package e2e provides utilities for end2end testing of xDS functionality. |
e2e/setup Package setup implements setup helpers for xDS e2e tests. | Package setup implements setup helpers for xDS e2e tests. |
fakeserver Package fakeserver provides a fake implementation of the management server. | Package fakeserver provides a fake implementation of the management server. |