testenv

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testenv starts a local API server (envtest) with the Inkwall CRDs installed, for operator tests. The kube-apiserver and etcd binaries come from KUBEBUILDER_ASSETS, which `make test` sets; without it the tests that need the server are skipped.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CRDDir

func CRDDir() string

CRDDir is the directory of the generated CRDs.

func InstallEnvoyGateway added in v0.3.0

func InstallEnvoyGateway(e *Env) error

InstallEnvoyGateway installs stand-ins for Envoy Gateway's CRDs (testenv/envoy-gateway) while the operator runs, and waits until they are served.

func InstallGatewayAPI added in v0.3.0

func InstallGatewayAPI(e *Env) error

InstallGatewayAPI installs stand-ins for Gateway API's GatewayClass, Gateway and HTTPRoute CRDs (testenv/gateway-api) while the operator runs, and waits until they are served.

func InstallLater added in v0.1.1

func InstallLater(e *Env) error

InstallLater installs the CRDs a test adds while the operator runs (testenv/later: Traefik's IngressRoute), and waits until they are served.

func SamplesDir

func SamplesDir() string

SamplesDir is the directory of the sample objects.

func Skip

func Skip(t testing.TB, e *Env)

Skip skips t when there is no API server.

Types

type Env

type Env struct {
	// Config reaches the API server.
	Config *rest.Config
	// WebhookPort is where the API server calls the webhooks, on
	// localhost, when they are installed.
	WebhookPort int
	// contains filtered or unexported fields
}

Env is a running API server.

func Start

func Start(o Options) (*Env, func(), error)

Start starts an API server, typically from TestMain, and returns it and a function that stops it. The Env is nil when KUBEBUILDER_ASSETS is not set; Skip then skips the tests.

func (*Env) User added in v0.1.1

func (e *Env) User(name string, groups ...string) (*rest.Config, error)

User returns a configuration for another user of the API server, in the given groups ("system:masters" may do anything).

type Options

type Options struct {
	// Webhooks installs the operator's webhook configuration, pointed at
	// https://localhost:<WebhookPort>.
	Webhooks bool
}

Options configures Start.

Jump to

Keyboard shortcuts

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