env

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserClientName = "me@example.com"
)

Variables

This section is empty.

Functions

func GetenvOrFail added in v0.11.0

func GetenvOrFail(t *testing.T, name string) string

GetenvOrFail returns the specified environment variable, or fails if the variable is undefined or empty.

Types

type Environment

type Environment struct {
	// Environment holds the controller-runtime envtest Environment
	*envtest.Environment

	// AdminClient is a client that is authenticated as admin which has
	// permissions to do anything.
	AdminClient client.Client

	// UserClient is a client that is authenticated as the user "me@example.com",
	// groups ["group-1", "group-2"].
	UserClient client.Client
}

Environment is a struct for holding the active and running controller-runtime envtest Environment, as well as approver-policy specific helper resources for running tests.

func RunControlPlane

func RunControlPlane(t *testing.T, ctx context.Context, crdDirs ...string) *Environment

RunControlPlane runs a local API server and makes it ready for running tests against. Also runs the cert-manager webhook for operating over cert-manager resources. Expects CRD directories to both cert-manager, as well as approver-policy. This *MUST* be provided. Returns a controller-runtime envtest which is ready to be run against.

Jump to

Keyboard shortcuts

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