env

package
v0.5.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func RootDirOrSkip

func RootDirOrSkip(t *testing.T) string

RootDirOrSkip returns the ROOTDIR environment variable, or skips if the variable is undefined or empty.

func RunSuite

func RunSuite(t *testing.T, suiteName, artifactsDir string)

RunSuite runs a Ginkgo test suite, and writes the results to the artefacts directory. The artifacts directory may be overridden with `ARTIFACTS` environment variable.

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