e2e

package
v1.37.0-dev Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package e2e provides utilities for end2end testing of xDS functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultFileWatcherConfig

func DefaultFileWatcherConfig(certPath, keyPath, caPath string) map[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 SetupBootstrapFile

func SetupBootstrapFile(opts BootstrapOptions) (func(), error)

SetupBootstrapFile creates a temporary file with bootstrap contents, based on the passed in options, and updates the bootstrap environment variable to point to this file.

Returns a cleanup function which will be non-nil if the setup process was completed successfully. It is the responsibility of the caller to invoke the cleanup function at the end of the test.

Types

type BootstrapOptions

type BootstrapOptions struct {
	// Version is the xDS transport protocol version.
	Version TransportAPI
	// NodeID is the node identifier of the gRPC client/server node in the
	// proxyless service mesh.
	NodeID string
	// ServerURI is the address of the management server.
	ServerURI string
	// ServerResourceNameID is the Listener resource name to fetch.
	ServerResourceNameID string
	// CertificateProviders is the certificate providers configuration.
	CertificateProviders map[string]json.RawMessage
}

BootstrapOptions wraps the parameters passed to SetupBootstrapFile.

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(opts UpdateOptions) error

Update changes the resource snapshot held by the management server, which updates connected clients as required.

type TransportAPI

type TransportAPI int

TransportAPI refers to the API version for xDS transport protocol.

const (
	// TransportV2 refers to the v2 xDS transport protocol.
	TransportV2 TransportAPI = iota
	// TransportV3 refers to the v3 xDS transport protocol.
	TransportV3
)

type UpdateOptions

type UpdateOptions struct {
	// NodeID is the id of the client to which this update is to be pushed.
	NodeID string
	// Listeners is the updated list of listener resources.
	Listeners []*v3listenerpb.Listener
}

UpdateOptions wraps parameters to be passed to the Update() method.

Jump to

Keyboard shortcuts

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