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

package fakeclient

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

Package fakeclient provides a fake implementation of an xDS client.

Index

Package Files

client.go

type Client Uses

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

Client is a fake implementation of an xds client. It exposes a bunch of channels to signal the occurrence of various events.

func NewClient Uses

func NewClient() *Client

NewClient returns a new fake xds client.

func NewClientWithName Uses

func NewClientWithName(name string) *Client

NewClientWithName returns a new fake xds client with the provided name. This is used in cases where multiple clients are created in the tests and we need to make sure the client is created for the expected balancer name.

func (*Client) BootstrapConfig Uses

func (xdsC *Client) BootstrapConfig() *bootstrap.Config

BootstrapConfig returns the bootstrap config.

func (*Client) Close Uses

func (xdsC *Client) Close()

Close closes the xds client.

func (*Client) InvokeWatchClusterCallback Uses

func (xdsC *Client) InvokeWatchClusterCallback(update xdsclient.ClusterUpdate, err error)

InvokeWatchClusterCallback invokes the registered cdsWatch callback.

Not thread safe with WatchCluster. Only call this after WaitForWatchCluster.

func (*Client) InvokeWatchEDSCallback Uses

func (xdsC *Client) InvokeWatchEDSCallback(update xdsclient.EndpointsUpdate, err error)

InvokeWatchEDSCallback invokes the registered edsWatch callback.

Not thread safe with WatchEndpoints. Only call this after WaitForWatchEDS.

func (*Client) InvokeWatchListenerCallback Uses

func (xdsC *Client) InvokeWatchListenerCallback(update xdsclient.ListenerUpdate, err error)

InvokeWatchListenerCallback invokes the registered ldsWatch callback.

Not thread safe with WatchListener. Only call this after WaitForWatchListener.

func (*Client) InvokeWatchRouteConfigCallback Uses

func (xdsC *Client) InvokeWatchRouteConfigCallback(update xdsclient.RouteConfigUpdate, err error)

InvokeWatchRouteConfigCallback invokes the registered rdsWatch callback.

Not thread safe with WatchRouteConfig. Only call this after WaitForWatchRouteConfig.

func (*Client) LoadStore Uses

func (xdsC *Client) LoadStore() *load.Store

LoadStore returns the underlying load data store.

func (*Client) Name Uses

func (xdsC *Client) Name() string

Name returns the name of the xds client.

func (*Client) ReportLoad Uses

func (xdsC *Client) ReportLoad(server string) (loadStore *load.Store, cancel func())

ReportLoad starts reporting load about clusterName to server.

func (*Client) SetBootstrapConfig Uses

func (xdsC *Client) SetBootstrapConfig(cfg *bootstrap.Config)

SetBootstrapConfig updates the bootstrap config.

func (*Client) WaitForCancelClusterWatch Uses

func (xdsC *Client) WaitForCancelClusterWatch(ctx context.Context) error

WaitForCancelClusterWatch waits for a CDS watch to be cancelled and returns context.DeadlineExceeded otherwise.

func (*Client) WaitForCancelEDSWatch Uses

func (xdsC *Client) WaitForCancelEDSWatch(ctx context.Context) error

WaitForCancelEDSWatch waits for a EDS watch to be cancelled and returns context.DeadlineExceeded otherwise.

func (*Client) WaitForCancelListenerWatch Uses

func (xdsC *Client) WaitForCancelListenerWatch(ctx context.Context) error

WaitForCancelListenerWatch waits for a LDS watch to be cancelled and returns context.DeadlineExceeded otherwise.

func (*Client) WaitForCancelRouteConfigWatch Uses

func (xdsC *Client) WaitForCancelRouteConfigWatch(ctx context.Context) error

WaitForCancelRouteConfigWatch waits for a RDS watch to be cancelled and returns context.DeadlineExceeded otherwise.

func (*Client) WaitForClose Uses

func (xdsC *Client) WaitForClose(ctx context.Context) error

WaitForClose waits for Close to be invoked on this client and returns context.DeadlineExceeded otherwise.

func (*Client) WaitForReportLoad Uses

func (xdsC *Client) WaitForReportLoad(ctx context.Context) (ReportLoadArgs, error)

WaitForReportLoad waits for ReportLoad to be invoked on this client and returns the arguments passed to it.

func (*Client) WaitForWatchCluster Uses

func (xdsC *Client) WaitForWatchCluster(ctx context.Context) (string, error)

WaitForWatchCluster waits for WatchCluster to be invoked on this client and returns the clusterName being watched.

func (*Client) WaitForWatchEDS Uses

func (xdsC *Client) WaitForWatchEDS(ctx context.Context) (string, error)

WaitForWatchEDS waits for WatchEndpoints to be invoked on this client and returns the clusterName being watched.

func (*Client) WaitForWatchListener Uses

func (xdsC *Client) WaitForWatchListener(ctx context.Context) (string, error)

WaitForWatchListener waits for WatchCluster to be invoked on this client and returns the serviceName being watched.

func (*Client) WaitForWatchRouteConfig Uses

func (xdsC *Client) WaitForWatchRouteConfig(ctx context.Context) (string, error)

WaitForWatchRouteConfig waits for WatchCluster to be invoked on this client and returns the routeName being watched.

func (*Client) WatchCluster Uses

func (xdsC *Client) WatchCluster(clusterName string, callback func(xdsclient.ClusterUpdate, error)) func()

WatchCluster registers a CDS watch.

func (*Client) WatchEndpoints Uses

func (xdsC *Client) WatchEndpoints(clusterName string, callback func(xdsclient.EndpointsUpdate, error)) (cancel func())

WatchEndpoints registers an EDS watch for provided clusterName.

func (*Client) WatchListener Uses

func (xdsC *Client) WatchListener(serviceName string, callback func(xdsclient.ListenerUpdate, error)) func()

WatchListener registers a LDS watch.

func (*Client) WatchRouteConfig Uses

func (xdsC *Client) WatchRouteConfig(routeName string, callback func(xdsclient.RouteConfigUpdate, error)) func()

WatchRouteConfig registers a RDS watch.

type ReportLoadArgs Uses

type ReportLoadArgs struct {
    // Server is the name of the server to which the load is reported.
    Server string
}

ReportLoadArgs wraps the arguments passed to ReportLoad.

Package fakeclient imports 5 packages (graph). Updated 2020-11-23. Refresh now. Tools for package owners.