Documentation ¶
Overview ¶
Package fakeclient provides a fake implementation of an xDS client.
Index ¶
- type Client
- func (xdsC *Client) BootstrapConfig() *bootstrap.Config
- func (xdsC *Client) InvokeWatchClusterCallback(update xdsresource.ClusterUpdate, err error)
- func (xdsC *Client) InvokeWatchEDSCallback(name string, update xdsresource.EndpointsUpdate, err error)
- func (xdsC *Client) InvokeWatchListenerCallback(update xdsresource.ListenerUpdate, err error)
- func (xdsC *Client) InvokeWatchRouteConfigCallback(name string, update xdsresource.RouteConfigUpdate, err error)
- func (xdsC *Client) LoadStore() *load.Store
- func (xdsC *Client) Name() string
- func (xdsC *Client) ReportLoad(server *bootstrap.ServerConfig) (loadStore *load.Store, cancel func())
- func (xdsC *Client) SetBootstrapConfig(cfg *bootstrap.Config)
- func (xdsC *Client) WaitForCancelClusterWatch(ctx context.Context) (string, error)
- func (xdsC *Client) WaitForCancelEDSWatch(ctx context.Context) (string, error)
- func (xdsC *Client) WaitForCancelListenerWatch(ctx context.Context) error
- func (xdsC *Client) WaitForCancelReportLoad(ctx context.Context) error
- func (xdsC *Client) WaitForCancelRouteConfigWatch(ctx context.Context) (string, error)
- func (xdsC *Client) WaitForReportLoad(ctx context.Context) (ReportLoadArgs, error)
- func (xdsC *Client) WaitForWatchCluster(ctx context.Context) (string, error)
- func (xdsC *Client) WaitForWatchEDS(ctx context.Context) (string, error)
- func (xdsC *Client) WaitForWatchListener(ctx context.Context) (string, error)
- func (xdsC *Client) WaitForWatchRouteConfig(ctx context.Context) (string, error)
- func (xdsC *Client) WatchCluster(clusterName string, callback func(xdsresource.ClusterUpdate, error)) func()
- func (xdsC *Client) WatchEndpoints(clusterName string, callback func(xdsresource.EndpointsUpdate, error)) (cancel func())
- func (xdsC *Client) WatchListener(serviceName string, callback func(xdsresource.ListenerUpdate, error)) func()
- func (xdsC *Client) WatchRouteConfig(routeName string, callback func(xdsresource.RouteConfigUpdate, error)) func()
- type ReportLoadArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // Embed XDSClient so this fake client implements the interface, but it's // never set (it's always nil). This may cause nil panic since not all the // methods are implemented. xdsclient.XDSClient // 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 NewClientWithName ¶
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 ¶ added in v1.34.0
BootstrapConfig returns the bootstrap config.
func (*Client) InvokeWatchClusterCallback ¶
func (xdsC *Client) InvokeWatchClusterCallback(update xdsresource.ClusterUpdate, err error)
InvokeWatchClusterCallback invokes the registered cdsWatch callback.
Not thread safe with WatchCluster. Only call this after WaitForWatchCluster.
func (*Client) InvokeWatchEDSCallback ¶
func (xdsC *Client) InvokeWatchEDSCallback(name string, update xdsresource.EndpointsUpdate, err error)
InvokeWatchEDSCallback invokes the registered edsWatch callback.
Not thread safe with WatchEndpoints. Only call this after WaitForWatchEDS.
func (*Client) InvokeWatchListenerCallback ¶ added in v1.34.0
func (xdsC *Client) InvokeWatchListenerCallback(update xdsresource.ListenerUpdate, err error)
InvokeWatchListenerCallback invokes the registered ldsWatch callback.
Not thread safe with WatchListener. Only call this after WaitForWatchListener.
func (*Client) InvokeWatchRouteConfigCallback ¶ added in v1.34.0
func (xdsC *Client) InvokeWatchRouteConfigCallback(name string, update xdsresource.RouteConfigUpdate, err error)
InvokeWatchRouteConfigCallback invokes the registered rdsWatch callback.
Not thread safe with WatchRouteConfig. Only call this after WaitForWatchRouteConfig.
func (*Client) ReportLoad ¶
func (xdsC *Client) ReportLoad(server *bootstrap.ServerConfig) (loadStore *load.Store, cancel func())
ReportLoad starts reporting load about clusterName to server.
func (*Client) SetBootstrapConfig ¶ added in v1.34.0
SetBootstrapConfig updates the bootstrap config.
func (*Client) WaitForCancelClusterWatch ¶
WaitForCancelClusterWatch waits for a CDS watch to be cancelled and returns context.DeadlineExceeded otherwise.
func (*Client) WaitForCancelEDSWatch ¶ added in v1.30.0
WaitForCancelEDSWatch waits for a EDS watch to be cancelled and returns context.DeadlineExceeded otherwise.
func (*Client) WaitForCancelListenerWatch ¶ added in v1.34.0
WaitForCancelListenerWatch waits for a LDS watch to be cancelled and returns context.DeadlineExceeded otherwise.
func (*Client) WaitForCancelReportLoad ¶ added in v1.40.0
WaitForCancelReportLoad waits for a load report to be cancelled and returns context.DeadlineExceeded otherwise.
func (*Client) WaitForCancelRouteConfigWatch ¶ added in v1.34.0
WaitForCancelRouteConfigWatch waits for a RDS watch to be cancelled and returns context.DeadlineExceeded otherwise.
func (*Client) WaitForReportLoad ¶
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 ¶
WaitForWatchCluster waits for WatchCluster to be invoked on this client and returns the clusterName being watched.
func (*Client) WaitForWatchEDS ¶
WaitForWatchEDS waits for WatchEndpoints to be invoked on this client and returns the clusterName being watched.
func (*Client) WaitForWatchListener ¶ added in v1.34.0
WaitForWatchListener waits for WatchCluster to be invoked on this client and returns the serviceName being watched.
func (*Client) WaitForWatchRouteConfig ¶ added in v1.34.0
WaitForWatchRouteConfig waits for WatchCluster to be invoked on this client and returns the routeName being watched.
func (*Client) WatchCluster ¶
func (xdsC *Client) WatchCluster(clusterName string, callback func(xdsresource.ClusterUpdate, error)) func()
WatchCluster registers a CDS watch.
func (*Client) WatchEndpoints ¶ added in v1.29.0
func (xdsC *Client) WatchEndpoints(clusterName string, callback func(xdsresource.EndpointsUpdate, error)) (cancel func())
WatchEndpoints registers an EDS watch for provided clusterName.
func (*Client) WatchListener ¶ added in v1.34.0
func (xdsC *Client) WatchListener(serviceName string, callback func(xdsresource.ListenerUpdate, error)) func()
WatchListener registers a LDS watch.
func (*Client) WatchRouteConfig ¶ added in v1.34.0
func (xdsC *Client) WatchRouteConfig(routeName string, callback func(xdsresource.RouteConfigUpdate, error)) func()
WatchRouteConfig registers a RDS watch.
type ReportLoadArgs ¶
type ReportLoadArgs struct { // Server is the name of the server to which the load is reported. Server *bootstrap.ServerConfig }
ReportLoadArgs wraps the arguments passed to ReportLoad.