driver

package
v0.0.0-...-5d72fda Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: Apache-2.0 Imports: 62 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultTimeout = 10 * time.Second
	None           = "-"
	Any            = "*"
)
View Source
const (
	// APIType for extension configs.
	APIType = "type.googleapis.com/envoy.config.core.v3.TypedExtensionConfig"
)
View Source
const WorkloadTypeURL = "type.googleapis.com/istio.workload.Workload"

Variables

This section is empty.

Functions

func BazelWorkspace

func BazelWorkspace() string

func LoadTestData

func LoadTestData(testFileName string) string

Loads a test file content

func LoadTestJSON

func LoadTestJSON(testFileName string) string

Load a YAML and converts to JSON

func ReadYAML

func ReadYAML(input string, pb legacyproto.Message) error

func TestPath

func TestPath(testFileName string) string

Normalizes test data path

Types

type Envoy

type Envoy struct {
	// template for the bootstrap
	Bootstrap string

	// Istio proxy version to download.
	// This could be either a patch version (x.y.z), or a minor version (x.y), or master.
	// When minor version or master is provided, proxy binary will downloaded based on
	// the latest proxy SHA that istio minor version branch points to.
	// DownloadVersion will be ignored if proxy binary already exists at the
	// default bazel-bin location, or ENVOY_PATH env var is set.
	DownloadVersion string

	// standard error for the Envoy process (defaults to os.Stderr).
	Stderr io.Writer
	// standard out for the Envoy process (defaults to os.Stdout).
	Stdout io.Writer

	// Value used to set the --concurrency flag when starting envoy.
	Concurrency uint32
	// contains filtered or unexported fields
}

Envoy starts up a Envoy process locally.

func (*Envoy) Cleanup

func (e *Envoy) Cleanup()

Cleanup stops the Envoy process.

func (*Envoy) Run

func (e *Envoy) Run(p *Params) error

Run starts a Envoy process.

type ExactStat

type ExactStat struct {
	Metric string
}

func (*ExactStat) Matches

func (me *ExactStat) Matches(params *Params, that *dto.MetricFamily) error

type ExistStat

type ExistStat struct {
	Metric string
}

ExistStat matches if the metric exists in the output, but does not compare the Counter.

func (*ExistStat) Matches

func (me *ExistStat) Matches(params *Params, that *dto.MetricFamily) error

type ExtensionServer

type ExtensionServer struct {
	server.Server
	server.CallbackFuncs
	// contains filtered or unexported fields
}

ExtensionServer is the main server instance.

func NewExtensionServer

func NewExtensionServer(ctx context.Context) *ExtensionServer

func (*ExtensionServer) Delete

func (es *ExtensionServer) Delete(name string) error

func (*ExtensionServer) FetchExtensionConfigs

func (es *ExtensionServer) FetchExtensionConfigs(ctx context.Context, req *discovery.DiscoveryRequest) (*discovery.DiscoveryResponse, error)

func (*ExtensionServer) Update

func (es *ExtensionServer) Update(config *core.TypedExtensionConfig) error

type Fork

type Fork struct {
	Fore Step
	Back Step
}

Fork will copy params to avoid concurrent access

func (*Fork) Cleanup

func (f *Fork) Cleanup()

func (*Fork) Run

func (f *Fork) Run(p *Params) error

type GrpcCall

type GrpcCall struct {
	ReqCount   int
	WantStatus *status.Status
}

func (*GrpcCall) Cleanup

func (g *GrpcCall) Cleanup()

func (*GrpcCall) Run

func (g *GrpcCall) Run(p *Params) error

type GrpcServer

type GrpcServer struct {
	// contains filtered or unexported fields
}

func (*GrpcServer) Cleanup

func (g *GrpcServer) Cleanup()

func (*GrpcServer) Run

func (g *GrpcServer) Run(p *Params) error

type GrpcStream

type GrpcStream struct {
	// contains filtered or unexported fields
}

func (*GrpcStream) Cleanup

func (g *GrpcStream) Cleanup()

func (*GrpcStream) Close

func (g *GrpcStream) Close() Step

func (*GrpcStream) Run

func (g *GrpcStream) Run(p *Params) error

func (*GrpcStream) Send

func (g *GrpcStream) Send(counts []uint32) Step

type HTTPCall

type HTTPCall struct {
	// Method
	Method string
	// Authority override
	Authority string
	// URL path
	Path string
	// Port specifies the port in 127.0.0.1:PORT
	Port uint16
	// Body is the expected body
	Body string
	// RequestHeaders to send with the request
	RequestHeaders map[string]string
	// ResponseCode to expect
	ResponseCode int
	// ResponseHeaders to expect
	ResponseHeaders map[string]string
	// Timeout (must be set to avoid the default)
	Timeout time.Duration
	// DisableRedirect prevents the client from following redirects and returns the original response.
	DisableRedirect bool
	// IP address override instead of 127.0.0.1
	IP string
}

HTTPCall sends a HTTP request to a localhost port, and then check the response code, and response headers.

func Get

func Get(port uint16, body string) *HTTPCall

func (*HTTPCall) Cleanup

func (g *HTTPCall) Cleanup()

func (*HTTPCall) Run

func (g *HTTPCall) Run(p *Params) error

type InterceptedTCPConnection

type InterceptedTCPConnection struct {
	ReadTimeout time.Duration
}

InterceptedTCPConnection is a connection which expects the terminated connection (before the timeout occurs)

func (*InterceptedTCPConnection) Cleanup

func (t *InterceptedTCPConnection) Cleanup()

func (*InterceptedTCPConnection) Run

type MissingStat

type MissingStat struct {
	Metric string
}

func (*MissingStat) Matches

func (m *MissingStat) Matches(_ *Params, that *dto.MetricFamily) error

type NamedWorkload

type NamedWorkload struct {
	*workloadapi.Workload
}

func (*NamedWorkload) GetName

func (nw *NamedWorkload) GetName() string

type Otel

type Otel struct {
	OtelLogs
	OtelMetrics

	Port uint16
	// Metrics contains the expected (total) metric protos. Clients must produce them exactly.
	Metrics []string
	// contains filtered or unexported fields
}

func (*Otel) Cleanup

func (x *Otel) Cleanup()

func (*Otel) Run

func (x *Otel) Run(p *Params) error

func (*Otel) Wait

func (x *Otel) Wait() Step

type OtelMetrics

type OtelMetrics struct {
	colmetricspb.UnimplementedMetricsServiceServer
	// contains filtered or unexported fields
}

type Params

type Params struct {
	// Config is the XDS server state.
	Config XDSServer

	// Ports record the port assignment for a test.
	Ports *env.Ports

	// Vars include the variables which are used to fill in configuration template files.
	Vars map[string]string

	// N records the index of repetition. It is only valid when using with Repeat step.
	N int
}

Params include test context that is shared by all steps.

func NewTestParams

func NewTestParams(t *testing.T, vars map[string]string, inv *env.TestInventory) *Params

NewTestParams creates a new test params struct which keeps state of a test. vars will be used for template filling. A set of ports will be assigned. If TestInventory is provided, the port assignment will be offsetted based on the index of the test in the inventory.

func (*Params) Fill

func (p *Params) Fill(s string) (string, error)

Fill a template file with ariable map in Params.

func (*Params) FillTestData

func (p *Params) FillTestData(data string) string

Fills in template variables in the given template data

func (*Params) FillYAML

func (p *Params) FillYAML(input string, pb legacyproto.Message) error

func (*Params) LoadTestData

func (p *Params) LoadTestData(testFileName string) string

Loads a test file and fills in template variables

func (*Params) LoadTestProto

func (p *Params) LoadTestProto(testFileName string, msg legacyproto.Message) legacyproto.Message

Loads a test file as YAML into a proto and fills in template variables

type PartialStat

type PartialStat struct {
	Metric string
}

func (*PartialStat) Matches

func (me *PartialStat) Matches(params *Params, that *dto.MetricFamily) error

type Repeat

type Repeat struct {
	N        int
	Duration time.Duration
	Step     Step
}

Repeat a step either for N number or duration

func (*Repeat) Cleanup

func (r *Repeat) Cleanup()

func (*Repeat) Run

func (r *Repeat) Run(p *Params) error

type Scenario

type Scenario struct {
	// Steps is a collection of steps which be executed sequentially.
	Steps []Step
}

Scenario is a collection of Steps. It runs and cleans up all steps sequentially.

func (*Scenario) Cleanup

func (s *Scenario) Cleanup()

func (*Scenario) Run

func (s *Scenario) Run(p *Params) error

type Sleep

type Sleep struct {
	time.Duration
}

Sleep injects a sleep with the given duration into the test execution.

func (*Sleep) Cleanup

func (s *Sleep) Cleanup()

func (*Sleep) Run

func (s *Sleep) Run(_ *Params) error

type StatMatcher

type StatMatcher interface {
	Matches(*Params, *dto.MetricFamily) error
}

type Stats

type Stats struct {
	AdminPort uint16
	Matchers  map[string]StatMatcher
}

func (*Stats) Cleanup

func (s *Stats) Cleanup()

func (*Stats) Run

func (s *Stats) Run(p *Params) error

type Step

type Step interface {
	// Run wraps the logic of a test step.
	Run(*Params) error

	// Cleanup cleans up all the test artifacts created by Run.
	Cleanup()
}

Step is a unit of execution in the integration test.

type StepFunction

type StepFunction func(p *Params) error

StepFunction models Lambda captured step

func (StepFunction) Cleanup

func (s StepFunction) Cleanup()

func (StepFunction) Run

func (s StepFunction) Run(p *Params) error

type TCPConnection

type TCPConnection struct{}

func (*TCPConnection) Cleanup

func (t *TCPConnection) Cleanup()

func (*TCPConnection) Run

func (t *TCPConnection) Run(p *Params) error

type TCPLoad

type TCPLoad struct {
	// contains filtered or unexported fields
}

func (*TCPLoad) Cleanup

func (t *TCPLoad) Cleanup()

func (*TCPLoad) Run

func (t *TCPLoad) Run(p *Params) error

type TCPServer

type TCPServer struct {
	Prefix string
	// contains filtered or unexported fields
}

func (*TCPServer) Cleanup

func (t *TCPServer) Cleanup()

func (*TCPServer) Run

func (t *TCPServer) Run(p *Params) error

type TCPServerAcceptAndClose

type TCPServerAcceptAndClose struct {
	// contains filtered or unexported fields
}

TCPServerAcceptAndClose implements a TCP server which accepts the data and then closes the connection immediately without any response.

The exception from this description is the "ping" data which is handled differently for checking if the server is already up.

func (*TCPServerAcceptAndClose) Cleanup

func (t *TCPServerAcceptAndClose) Cleanup()

func (*TCPServerAcceptAndClose) Run

type Update

type Update struct {
	Node      string
	Version   string
	Listeners []string
	Clusters  []string
	Secrets   []string
}

func (*Update) Cleanup

func (u *Update) Cleanup()

func (*Update) Run

func (u *Update) Run(p *Params) error

type UpdateExtensions

type UpdateExtensions struct {
	Extensions []string
}

func (*UpdateExtensions) Cleanup

func (u *UpdateExtensions) Cleanup()

func (*UpdateExtensions) Run

func (u *UpdateExtensions) Run(p *Params) error

type UpdateWorkloadMetadata

type UpdateWorkloadMetadata struct {
	Workloads []WorkloadMetadata
}

func (*UpdateWorkloadMetadata) Cleanup

func (u *UpdateWorkloadMetadata) Cleanup()

func (*UpdateWorkloadMetadata) Run

func (u *UpdateWorkloadMetadata) Run(p *Params) error

type WorkloadMetadata

type WorkloadMetadata struct {
	Address  string
	Metadata string
}

type XDS

type XDS struct {
	// contains filtered or unexported fields
}

XDS creates an xDS server

func (*XDS) Cleanup

func (x *XDS) Cleanup()

Cleanup stops the XDS server.

func (*XDS) Debugf

func (x *XDS) Debugf(format string, args ...interface{})

func (*XDS) Errorf

func (x *XDS) Errorf(format string, args ...interface{})

func (*XDS) Infof

func (x *XDS) Infof(format string, args ...interface{})

func (*XDS) Run

func (x *XDS) Run(p *Params) error

Run starts up an Envoy XDS server.

func (*XDS) Warnf

func (x *XDS) Warnf(format string, args ...interface{})

type XDSServer

type XDSServer struct {
	cache.MuxCache
	Extensions *ExtensionServer
	Cache      cache.SnapshotCache
	Workloads  *cache.LinearCache
}

XDSServer is a struct holding xDS state.

Jump to

Keyboard shortcuts

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