e2eutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package e2eutil provides helpers for running end-to-end tests against a bink-managed Kubernetes cluster. The cluster and operator are expected to be already running (via `make deploy-bink`). Each test provisions its own worker nodes for isolation.

Index

Constants

View Source
const (
	// LabelE2ETest is applied to test-scoped resources (nodes, pools).
	// Its value is the sanitized test name, used for both node
	// selection and label-based cleanup.
	LabelE2ETest = "bootc.dev/e2e-test"
)

Variables

This section is empty.

Functions

func RetagImage

func RetagImage(t *testing.T, srcRef, dstTag string)

RetagImage reads the image at srcRef from the localhost registry and tags it as dstTag.

Types

type Env

type Env struct {
	// Client is a controller-runtime client with the bootc CRD scheme
	// registered.
	Client client.Client
	// contains filtered or unexported fields
}

Env holds a cluster context for a single e2e test. Each test creates its own Env via New(t), so test-scoped state (like the test ID used for node labeling and pool selectors) lives here.

func New

func New(t *testing.T) *Env

New connects to an existing bink cluster and returns an Env ready for testing. The cluster must be running with the operator deployed (via `make deploy-bink`).

func (*Env) AddNode

func (e *Env) AddNode(t *testing.T, opts ...NodeOption) string

AddNode provisions a worker node via bink, waits for it to be Ready, and returns the node name. The node is labeled with LabelE2ETest (and any extra labels from WithLabel).

func (*Env) NewPool

func (e *Env) NewPool(
	suffix, imageRef string,
	opts ...testutil.PoolOption,
) *bootcv1alpha1.BootcNodePool

NewPool creates a BootcNodePool with a test-scoped name and labels. The pool is labeled with LabelE2ETest for cleanup. If no WithNodeSelector option is provided, it defaults to selecting nodes with LabelE2ETest (i.e. all nodes belonging to this test).

func (*Env) NodeImageDigest

func (e *Env) NodeImageDigest() string

NodeImageDigest returns the manifest digest of the seeded node image.

func (*Env) NodeImageDigestedPullSpec

func (e *Env) NodeImageDigestedPullSpec() string

NodeImageDigestedPullSpec returns the digest-qualified reference for the seeded node image (e.g. "registry.cluster.local:5000/node@sha256:abc123").

func (*Env) NodeImageTagRef

func (e *Env) NodeImageTagRef() string

NodeImageTagRef returns the tag-based reference for the seeded node image (e.g. "registry.cluster.local:5000/node:latest").

func (*Env) NodeImageUpdate2Digest

func (e *Env) NodeImageUpdate2Digest() string

NodeImageUpdate2Digest returns the manifest digest of the second update image.

func (*Env) NodeImageUpdate2DigestedPullSpec

func (e *Env) NodeImageUpdate2DigestedPullSpec() string

NodeImageUpdate2DigestedPullSpec returns the digest-qualified reference for the second update image (e.g. "registry.cluster.local:5000/node@sha256:789abc").

func (*Env) NodeImageUpdateDigest

func (e *Env) NodeImageUpdateDigest() string

NodeImageUpdateDigest returns the manifest digest of the update image.

func (*Env) NodeImageUpdateDigestedPullSpec

func (e *Env) NodeImageUpdateDigestedPullSpec() string

NodeImageUpdateDigestedPullSpec returns the digest-qualified reference for the update image (e.g. "registry.cluster.local:5000/node@sha256:def456").

func (*Env) RegistryPassword

func (e *Env) RegistryPassword() string

RegistryPassword returns the authenticated registry password, or empty if not configured.

func (*Env) RegistryUser

func (e *Env) RegistryUser() string

RegistryUser returns the authenticated registry username, or empty if not configured.

func (*Env) TestID

func (e *Env) TestID() string

TestID returns the sanitized test name used for naming resources.

func (*Env) TestLabels

func (e *Env) TestLabels() map[string]string

TestLabels returns the label map identifying resources belonging to this test. Use with testutil.WithNodeSelector() when overriding the default node selector in NewPool.

type NodeOption

type NodeOption func(*nodeConfig)

NodeOption configures a node provisioned by AddNode.

func WithLabel

func WithLabel(key, value string) NodeOption

WithLabel adds a label to the provisioned node. This is in addition to the LabelE2ETest label which is always applied.

func WithMemory

func WithMemory(mb int) NodeOption

WithMemory sets the VM memory in MB for the node.

func WithTargetImgRef

func WithTargetImgRef(ref string) NodeOption

WithTargetImgRef sets the target image reference for the node, passed as --target-imgref to bink node add. Overrides the automatic default that AddNode applies when registry metadata is available.

Jump to

Keyboard shortcuts

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