fakexds

package
v1.27.0-pre Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package fakexds provides fake implementation of multiple types, for use in xds tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient() *Client

NewClient returns a new fake xds client.

func NewClientWithName

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) Close

func (xdsC *Client) Close()

Close closes the xds client.

func (*Client) InvokeWatchEDSCallback

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

InvokeWatchEDSCallback invokes the registered edsWatch callback.

func (*Client) InvokeWatchServiceCallback

func (xdsC *Client) InvokeWatchServiceCallback(cluster string, err error)

InvokeWatchServiceCallback invokes the registered service watch callback.

func (*Client) Name

func (xdsC *Client) Name() string

Name returns the name of the xds client.

func (*Client) ReportLoad

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

ReportLoad starts reporting load about clusterName to server.

func (*Client) WaitForReportLoad

func (xdsC *Client) WaitForReportLoad() (ReportLoadArgs, error)

WaitForReportLoad waits for ReportLoad to be invoked on this client within a reasonable timeout, and returns the arguments passed to it.

func (*Client) WaitForWatchEDS

func (xdsC *Client) WaitForWatchEDS() (string, error)

WaitForWatchEDS waits for WatchEDS to be invoked on this client within a reasonable timeout, and returns the clusterName being watched.

func (*Client) WaitForWatchService

func (xdsC *Client) WaitForWatchService() (string, error)

WaitForWatchService waits for WatchService to be invoked on this client within a reasonable timeout, and returns the serviceName being watched.

func (*Client) WatchEDS

func (xdsC *Client) WatchEDS(clusterName string, callback func(*xdsclient.EDSUpdate, error)) (cancel func())

WatchEDS registers an EDS watch for provided clusterName.

func (*Client) WatchService

func (xdsC *Client) WatchService(target string, callback func(xdsclient.ServiceUpdate, error)) func()

WatchService registers a LDS/RDS watch.

type ReportLoadArgs

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

ReportLoadArgs wraps the arguments passed to ReportLoad.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL