Version: v0.0.0-...-16debb5 Latest Latest

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

Go to latest
Published: Aug 5, 2021 License: Apache-2.0 Imports: 19 Imported by: 4




View Source
const (
	STSTest uint16 = iota

All tests should be listed here to get their test ids


This section is empty.


func FindBinary

func FindBinary() (string, error)

FindBinary searches for an Envoy debug binary under ISTIO_OUT. If the ISTIO_OUT environment variable is not set, the default location under GOPATH is assumed. If ISTIO_OUT contains multiple debug binaries, the most recent file is used.

func FindBinaryOrFail

func FindBinaryOrFail(t test.Failer) string

FindBinaryOrFail calls FindBinary and fails the given test if an error occurs.


type Ports

type Ports struct {
	ClientProxyPort uint16
	ServerProxyPort uint16
	TCPProxyPort    uint16
	AdminPort       uint16
	BackendPort     uint16
	DiscoveryPort   uint16
	STSPort         uint16
	ExtraPort       uint16

	// Pilot ports
	PilotGrpcPort uint16
	PilotHTTPPort uint16

Ports stores all used ports

func NewEnvoyPorts

func NewEnvoyPorts(ports *Ports, name uint16) *Ports

NewEnvoyPorts allocate ports for Envoy

func NewPorts

func NewPorts(name uint16) *Ports

NewPorts allocate all ports based on test id.

type TestSetup

type TestSetup struct {

	// EnvoyTemplate is the bootstrap config used by envoy.
	EnvoyTemplate string

	// EnvoyParams contain extra envoy parameters to pass in the CLI (cluster, node)
	EnvoyParams []string

	// EnvoyConfigOpt allows passing additional parameters to the EnvoyTemplate
	EnvoyConfigOpt map[string]interface{}

	// IstioSrc is the base directory of istio sources. May be set for finding testdata or
	// other files in the source tree
	IstioSrc string

	// IstioOut is the base output directory.
	IstioOut string

	// AccessLogPath is the access log path for Envoy
	AccessLogPath string

	// Dir is the working dir for envoy
	Dir string
	// contains filtered or unexported fields

TestSetup store data for a test.

func NewTestSetup

func NewTestSetup(name uint16, t *testing.T) *TestSetup

NewTestSetup creates a new test setup "name" has to be defined in ports.go

func (*TestSetup) CACertPath

func (s *TestSetup) CACertPath() string

CACertPath gets CA cert file path. The path does not change after proxy restarts.

func (*TestSetup) CreateEnvoyConf

func (s *TestSetup) CreateEnvoyConf(path string) error

CreateEnvoyConf create envoy config.

func (*TestSetup) GetStatsMap

func (s *TestSetup) GetStatsMap() (map[string]uint64, error)

GetStatsMap fetches Envoy stats with retry, and returns stats in a map.

func (*TestSetup) JWTTokenPath

func (s *TestSetup) JWTTokenPath() string

JWTTokenPath gets JWT token path. The path does not change after proxy restarts.

func (*TestSetup) LastRequestHeaders

func (s *TestSetup) LastRequestHeaders() http.Header

LastRequestHeaders returns last backend request headers

func (*TestSetup) Ports

func (s *TestSetup) Ports() *Ports

Ports get ports object

func (*TestSetup) ReStartEnvoy

func (s *TestSetup) ReStartEnvoy()

ReStartEnvoy restarts Envoy

func (*TestSetup) SDSPath

func (s *TestSetup) SDSPath() string

SDSPath gets SDS path. The path does not change after proxy restarts.

func (*TestSetup) SetCheckDict

func (s *TestSetup) SetCheckDict(checkDict bool)

SetCheckDict set the checkDict flag

func (*TestSetup) SetDisableHotRestart

func (s *TestSetup) SetDisableHotRestart(disable bool)

SetDisableHotRestart sets whether disable the HotRestart feature of Envoy

func (*TestSetup) SetNoBackend

func (s *TestSetup) SetNoBackend(no bool)

SetNoBackend sets no backend flag

func (*TestSetup) SetNoProxy

func (s *TestSetup) SetNoProxy(no bool)

SetNoProxy set NoProxy flag

func (*TestSetup) SetStress

func (s *TestSetup) SetStress(stress bool)

SetStress set the stress flag

func (*TestSetup) SetUp

func (s *TestSetup) SetUp() error

SetUp setups Envoy and Backend server for test.

func (*TestSetup) SilentlyStopProxy

func (s *TestSetup) SilentlyStopProxy(silent bool)

SilentlyStopProxy ignores errors when stop proxy

func (*TestSetup) TearDown

func (s *TestSetup) TearDown()

TearDown shutdown the servers.

func (*TestSetup) VerifyStats

func (s *TestSetup) VerifyStats(expectedStats map[string]uint64)

VerifyStats verifies Envoy stats.

func (*TestSetup) VerifyStatsLT

func (s *TestSetup) VerifyStatsLT(actualStats string, expectedStat string, expectedStatVal uint64)

VerifyStatsLT verifies that Envoy stats contains stat expectedStat, whose value is less than expectedStatVal.

func (*TestSetup) WaitEnvoyReady

func (s *TestSetup) WaitEnvoyReady()

WaitEnvoyReady waits until envoy receives and applies all config

func (*TestSetup) WaitForStatsUpdateAndGetStats

func (s *TestSetup) WaitForStatsUpdateAndGetStats(waitDuration int) (string, error)

WaitForStatsUpdateAndGetStats waits for waitDuration seconds to let Envoy update stats, and sends request to Envoy for stats. Returns stats response.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto