e2e

package
v1.41.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package e2e provides utilities for end2end testing of xDS functionality.

Index

Constants

View Source
const (
	// ServerListenerResourceNameTemplate is the Listener resource name template
	// used on the server side.
	ServerListenerResourceNameTemplate = "grpc/server?xds.resource.listening_address=%s"
	// ClientSideCertProviderInstance is the certificate provider instance name
	// used in the Cluster resource on the client side.
	ClientSideCertProviderInstance = "client-side-certificate-provider-instance"
	// ServerSideCertProviderInstance is the certificate provider instance name
	// used in the Listener resource on the server side.
	ServerSideCertProviderInstance = "server-side-certificate-provider-instance"
)

Variables

View Source
var RouterHTTPFilter = HTTPFilter("router", &v3routerpb.Router{})

RouterHTTPFilter is the HTTP Filter configuration for the Router filter.

Functions

func DefaultClientListener added in v1.38.0

func DefaultClientListener(target, routeName string) *v3listenerpb.Listener

DefaultClientListener returns a basic xds Listener resource to be used on the client side.

func DefaultCluster added in v1.37.0

func DefaultCluster(clusterName, edsServiceName string, secLevel SecurityLevel) *v3clusterpb.Cluster

DefaultCluster returns a basic xds Cluster resource.

func DefaultEndpoint added in v1.37.0

func DefaultEndpoint(clusterName string, host string, port uint32) *v3endpointpb.ClusterLoadAssignment

DefaultEndpoint returns a basic xds Endpoint resource.

func DefaultFileWatcherConfig

func DefaultFileWatcherConfig(certPath, keyPath, caPath string) json.RawMessage

DefaultFileWatcherConfig is a helper function to create a default certificate provider plugin configuration. The test is expected to have setup the files appropriately before this configuration is used to instantiate providers.

func DefaultRouteConfig added in v1.37.0

func DefaultRouteConfig(routeName, ldsTarget, clusterName string) *v3routepb.RouteConfiguration

DefaultRouteConfig returns a basic xds RouteConfig resource.

func DefaultServerListener added in v1.38.0

func DefaultServerListener(host string, port uint32, secLevel SecurityLevel) *v3listenerpb.Listener

DefaultServerListener returns a basic xds Listener resource to be used on the server side.

func HTTPFilter added in v1.37.0

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
	// 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() (*ManagementServer, error)

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 required by the test logic. When the test is done, it should call the Stop() method to cleanup resources allocated by the management server.

func (*ManagementServer) Stop

func (s *ManagementServer) Stop()

Stop stops 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 ResourceParams added in v1.38.0

type ResourceParams struct {
	// DialTarget is the client's dial target. This is used as the name of the
	// Listener resource.
	DialTarget string
	// NodeID is the id of the xdsClient to which this update is to be pushed.
	NodeID string
	// Host is the host of the default Endpoint resource.
	Host string
	// port is the port of the default Endpoint resource.
	Port uint32
	// SecLevel controls the security configuration in the Cluster resource.
	SecLevel SecurityLevel
}

ResourceParams wraps the arguments to be passed to DefaultClientResources.

type SecurityLevel added in v1.38.0

type SecurityLevel int

SecurityLevel allows the test to control the security level to be used in the resource returned by this package.

const (
	// SecurityLevelNone is used when no security configuration is required.
	SecurityLevelNone SecurityLevel = iota
	// SecurityLevelTLS is used when security configuration corresponding to TLS
	// is required. Only the server presents an identity certificate in this
	// configuration.
	SecurityLevelTLS
	// SecurityLevelMTLS is used when security ocnfiguration corresponding to
	// mTLS is required. Both client and server present identity certificates in
	// this configuration.
	SecurityLevelMTLS
)

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.

func DefaultClientResources added in v1.37.0

func DefaultClientResources(params ResourceParams) UpdateOptions

DefaultClientResources returns a set of resources (LDS, RDS, CDS, EDS) for a client to generically connect to one server.

Jump to

Keyboard shortcuts

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