Documentation ¶
Overview ¶
This package contains helpers for configuring test runners that automate test setup/teardown. In general, every e2e test should at least have something like the following:
func TestMain(m *testing.M) { testenv = runners.NewRunner().Setup() os.Exit(testenv.Run(m)) }
The above code snippet will automatically bootstrap the cluster, install Cilium and Tetragon, port forward the necessary ports for gRPC and metrics, and register hooks to automatically clean up resources at the end of the test.
Index ¶
- Constants
- Variables
- type PortForwardFunc
- type Runner
- func (r *Runner) Init() *Runner
- func (r *Runner) NoInstallCilium() *Runner
- func (r *Runner) NoPortForward() *Runner
- func (r *Runner) Run(m *testing.M)
- func (r *Runner) SetupExport(t *testing.T)
- func (r *Runner) WithInstallCilium(options ...cilium.Option) *Runner
- func (r *Runner) WithInstallCiliumFn(install env.Func) *Runner
- func (r *Runner) WithInstallTetragon(options ...tetragon.Option) *Runner
- func (r *Runner) WithInstallTetragonFn(install env.Func) *Runner
- func (r *Runner) WithKeepExportFiles(keep bool) *Runner
- func (r *Runner) WithSetupClusterFn(setup SetupClusterFunc) *Runner
- type SetupClusterFunc
Constants ¶
View Source
const (
ClusterPrefix = "tetragon-ci"
)
Variables ¶
View Source
var DefaultRunner = Runner{ // contains filtered or unexported fields }
Functions ¶
This section is empty.
Types ¶
type PortForwardFunc ¶
type PortForwardFunc func(env.Environment) env.Func
type Runner ¶
type Runner struct { env.Environment // contains filtered or unexported fields }
func (*Runner) NoInstallCilium ¶
func (*Runner) NoPortForward ¶
func (*Runner) Run ¶
Run the tests. Exits with a corresponding status code. Must be called at the end of TestMain().
func (*Runner) SetupExport ¶ added in v0.10.0
Must be called at the beinning of every test.
func (*Runner) WithInstallCilium ¶
func (*Runner) WithInstallTetragon ¶
func (*Runner) WithInstallTetragonFn ¶
func (*Runner) WithKeepExportFiles ¶
func (*Runner) WithSetupClusterFn ¶
func (r *Runner) WithSetupClusterFn(setup SetupClusterFunc) *Runner
type SetupClusterFunc ¶
type SetupClusterFunc func(env.Environment) env.Func
Click to show internal directories.
Click to hide internal directories.