suite

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEnvoyImageVersion = "envoyproxy/envoy:contrib-v1.30-latest"
	DefaultWaitDuration      = 5 * time.Second
	DefaultTickDuration      = 100 * time.Millisecond
)

Variables

View Source
var (
	SkipTests = flag.String("skip-tests", "", "Comma-separated list of tests to skip")
	RunTest   = flag.String("run-test", "", "Name of a single test to run, instead of the whole suite")
)

Functions

This section is empty.

Types

type TestCase

type TestCase struct {
	// Name of the test case.
	Name string
	// Name of the filter.
	FilterName string
	// Description of the test case.
	Description string
	// Absolute directory path of the Envoy filter.
	EnvoyFilterAbsDir string
	// Absolute directory path of the Envoy configuration.
	EnvoyConfigAbsDir string
	// Name of the Envoy filter.
	EnvoyFilterName string
	// Name of the Envoy configuration.
	EnvoyConfigName string
	// Indicates whether the test case should be run in parallel.
	Parallel bool
	// Indicates whether the test case should explicitly be skipped.
	Skip bool
	// Test function for the test case.
	Test func(t *testing.T, kit *TestSuiteKit)
	// contains filtered or unexported fields
}

TestCase represents a test case for the test suite.

func (*TestCase) Run

func (tc *TestCase) Run(t *testing.T, suite *TestSuite)

type TestSuite

type TestSuite struct {
	// FilterLocation defines the pattern for locating the filter directory.
	// It defaults to "$PWD/filters/{filter}/{filename}".
	FilterLocation string
	// EnvoyImageVersion specifies the version of the Envoy image to be used.
	EnvoyImageVersion string
	// EnvoyPort specifies the port number on which Envoy will listen.
	EnvoyPort int
	// AdminPort specifies the port number for Envoy's admin interface.
	AdminPort int
	// RunTest specifies the specific test to run.
	RunTest string
	// SkipTests specifies a set of tests to be skipped.
	SkipTests sets.Set[string]
}

TestSuite represents a test suite configuration.

func NewTestSuite

func NewTestSuite(opts TestSuiteOptions) *TestSuite

func (*TestSuite) Run

func (suite *TestSuite) Run(t *testing.T, cases []TestCase)

type TestSuiteKit

type TestSuiteKit struct {
	// WaitDuration is the duration to wait for certain operations.
	WaitDuration time.Duration
	// TickDuration is the duration between ticks.
	TickDuration time.Duration
	// contains filtered or unexported fields
}

TestSuiteKit represents a test suite kit that contains various configuration options.

func (*TestSuiteKit) CheckEnvoyLog

func (s *TestSuiteKit) CheckEnvoyLog(expressions ...string) bool

func (*TestSuiteKit) GetAdminHost

func (s *TestSuiteKit) GetAdminHost() string

func (*TestSuiteKit) GetEnvoyHost

func (s *TestSuiteKit) GetEnvoyHost() string

func (*TestSuiteKit) ShowEnvoyLog added in v0.4.0

func (s *TestSuiteKit) ShowEnvoyLog() string

func (*TestSuiteKit) StartEnvoy

func (s *TestSuiteKit) StartEnvoy(t *testing.T) (kill func())

type TestSuiteOptions

type TestSuiteOptions struct {
	// EnvoyImageVersion specifies the version of the Envoy image to use.
	EnvoyImageVersion string
	// EnvoyPortStartFrom specifies the starting port number for Envoy instances.
	EnvoyPortStartFrom int
	// AdminPortStartFrom specifies the starting port number for Envoy admin interfaces.
	AdminPortStartFrom int
	// SkipTests is a list of test names to skip.
	SkipTests []string

	// FilterLocation defines the pattern for locating the filter directory.
	// If it is not provided, the default pattern would be "$PWD/filters/{filter}/{filename}".
	// Available substitutions:
	// - {filter} -> filter name
	// - {filename} -> file name, which are envoy.yaml and filter.so. Both can be overriden through the TestCase.
	// Example usage:
	//   FilterLocation: "/home/ardikabs/Workspaces/gonvoy/e2e/filters/{filter}/{filename}" ->
	//       1. Given 'filter' as the filter name, for a filter named 'helloworld', it translates to /home/ardikabs/Workspaces/gonvoy/e2e/filters/helloworld
	//       2. For the envoy.yaml file, it translates to /home/ardikabs/Workspaces/gonvoy/e2e/filters/helloworld/envoy.yaml
	//       3. For the filter.so file, it translates to /home/ardikabs/Workspaces/gonvoy/e2e/filters/helloworld/filter.so
	FilterLocation string
}

TestSuiteOptions represents the options for configuring a test suite.

Jump to

Keyboard shortcuts

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