Documentation
¶
Overview ¶
Package e2e provides utilities for end2end testing of xDS and LRS clients functionalities.
Index ¶
Constants ¶
const ( // ClientSideCertProviderInstance is the certificate provider instance name // used in the Cluster resource on the client side. ClientSideCertProviderInstance = "client-side-certificate-provider-instance" )
Variables ¶
var RouterHTTPFilter = HTTPFilter("router", &v3routerpb.Router{})
RouterHTTPFilter is the HTTP Filter configuration for the Router filter.
Functions ¶
func DefaultClientListener ¶
func DefaultClientListener(target, routeName string) *v3listenerpb.Listener
DefaultClientListener returns a basic xds Listener resource to be used on the client side.
func HTTPFilter ¶
func HTTPFilter(name string, config proto.Message) *v3httppb.HttpFilter
HTTPFilter constructs an xds HttpFilter with the provided name and config.
Types ¶
type ManagementServer ¶
type ManagementServer struct { // Address is the host:port on which the management server is listening for // new connections. Address string // LRSServer points to the fake LRS server implementation. Set only if the // SupportLoadReportingService option was set to true when creating this // management server. LRSServer *fakeserver.Server // contains filtered or unexported fields }
ManagementServer is a thin wrapper around the xDS control plane implementation provided by envoyproxy/go-control-plane.
func StartManagementServer ¶
func StartManagementServer(t *testing.T, opts ManagementServerOptions) *ManagementServer
StartManagementServer initializes a management server which implements the AggregatedDiscoveryService endpoint. The management server is initialized with no resources. Tests should call the Update() method to change the resource snapshot held by the management server, as per by the test logic.
Registers a cleanup function on t to stop the management server.
func (*ManagementServer) Update ¶
func (s *ManagementServer) Update(ctx context.Context, opts UpdateOptions) error
Update changes the resource snapshot held by the management server, which updates connected clients as required.
type ManagementServerOptions ¶
type ManagementServerOptions struct { // Listener to accept connections on. If nil, a TPC listener on a local port // will be created and used. Listener net.Listener // SupportLoadReportingService, if set, results in the load reporting // service being registered on the same port as that of ADS. SupportLoadReportingService bool // AllowResourceSubSet allows the management server to respond to requests // before all configured resources are explicitly named in the request. The // default behavior that we want is for the management server to wait for // all configured resources to be requested before responding to any of // them, since this is how we have run our tests historically, and should be // set to true only for tests which explicitly require the other behavior. AllowResourceSubset bool // ServerFeaturesIgnoreResourceDeletion, if set, results in a bootstrap config // where the server features list contains `ignore_resource_deletion`. This // results in gRPC ignoring resource deletions from the management server, as // per A53. ServerFeaturesIgnoreResourceDeletion bool // OnStreamOpen is called when an xDS stream is opened. The callback is // invoked with the assigned stream ID and the type URL from the incoming // request (or "" for ADS). // // Returning an error from this callback will end processing and close the // stream. OnStreamClosed will still be called. OnStreamOpen func(context.Context, int64, string) error // OnStreamClosed is called immediately prior to closing an xDS stream. The // callback is invoked with the stream ID of the stream being closed. OnStreamClosed func(int64, *v3corepb.Node) // OnStreamRequest is called when a request is received on the stream. The // callback is invoked with the stream ID of the stream on which the request // was received and the received request. // // Returning an error from this callback will end processing and close the // stream. OnStreamClosed will still be called. OnStreamRequest func(int64, *v3discoverypb.DiscoveryRequest) error // OnStreamResponse is called immediately prior to sending a response on the // stream. The callback is invoked with the stream ID of the stream on which // the response is being sent along with the incoming request and the outgoing // response. OnStreamResponse func(context.Context, int64, *v3discoverypb.DiscoveryRequest, *v3discoverypb.DiscoveryResponse) }
ManagementServerOptions contains options to be passed to the management server during creation.
type UpdateOptions ¶
type UpdateOptions struct { // NodeID is the id of the client to which this update is to be pushed. NodeID string // Endpoints, Clusters, Routes, and Listeners are the updated list of xds // resources for the server. All must be provided with each Update. Endpoints []*v3endpointpb.ClusterLoadAssignment Clusters []*v3clusterpb.Cluster Routes []*v3routepb.RouteConfiguration Listeners []*v3listenerpb.Listener // SkipValidation indicates whether we want to skip validation (by not // calling snapshot.Consistent()). It can be useful for negative tests, // where we send updates that the client will NACK. SkipValidation bool }
UpdateOptions wraps parameters to be passed to the Update() method.