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 ¶
- func CRDDir() string
- func DeleteOnCleanup(t testing.TB, c client.Client, objs ...client.Object)
- func FreeAddr(t testing.TB) string
- func InstallEnvoyGateway(e *Env) error
- func InstallGatewayAPI(e *Env) error
- func InstallIstio(e *Env) error
- func InstallLater(e *Env) error
- func Namespace(t testing.TB, c client.Client, prefix string) string
- func SamplesDir() string
- func Skip(t testing.TB, e *Env)
- type Env
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteOnCleanup ¶ added in v0.5.0
DeleteOnCleanup deletes objs (cluster-scoped ones, say) when t ends, so that the test can run again against the same API server.
func FreeAddr ¶ added in v0.5.0
FreeAddr returns "127.0.0.1:<port>" for a port a test's server can bind, on every interface, a moment later. The port is below the kernel's ephemeral range, from which every outgoing connection takes its local port: a free port picked inside it can be taken by a connection before the server binds it (#452). No two calls in a process return the same.
func InstallEnvoyGateway ¶ added in v0.3.0
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
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 InstallIstio ¶ added in v0.4.0
InstallIstio installs stand-ins for Istio's EnvoyFilter, VirtualService and Gateway CRDs (testenv/istio) while the operator runs, and waits until they are served.
func InstallLater ¶ added in v0.1.1
InstallLater installs the CRDs a test adds while the operator runs (testenv/later: Traefik's IngressRoute), and waits until they are served.
func Namespace ¶ added in v0.5.0
Namespace creates a namespace named prefix and a random suffix, and returns its name. A test that runs again against the same API server (go test -count) gets a new one: envtest has no namespace controller, so a deleted namespace stays Terminating and nothing can be created in it.
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.
type Options ¶
type Options struct {
// Webhooks installs the operator's webhook configuration, pointed at
// https://localhost:<WebhookPort>.
Webhooks bool
}
Options configures Start.