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
- func RetagImage(t *testing.T, srcRef, dstTag string)
- type Env
- func (e *Env) AddNode(t *testing.T, opts ...NodeOption) string
- func (e *Env) NewPool(suffix, imageRef string, opts ...testutil.PoolOption) *bootcv1alpha1.BootcNodePool
- func (e *Env) NodeImageDigest() string
- func (e *Env) NodeImageDigestedPullSpec() string
- func (e *Env) NodeImageTagRef() string
- func (e *Env) NodeImageUpdate2Digest() string
- func (e *Env) NodeImageUpdate2DigestedPullSpec() string
- func (e *Env) NodeImageUpdateDigest() string
- func (e *Env) NodeImageUpdateDigestedPullSpec() string
- func (e *Env) RegistryPassword() string
- func (e *Env) RegistryUser() string
- func (e *Env) TestID() string
- func (e *Env) TestLabels() map[string]string
- type NodeOption
Constants ¶
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 ¶
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 ¶
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 ¶
NodeImageDigest returns the manifest digest of the seeded node image.
func (*Env) NodeImageDigestedPullSpec ¶
NodeImageDigestedPullSpec returns the digest-qualified reference for the seeded node image (e.g. "registry.cluster.local:5000/node@sha256:abc123").
func (*Env) NodeImageTagRef ¶
NodeImageTagRef returns the tag-based reference for the seeded node image (e.g. "registry.cluster.local:5000/node:latest").
func (*Env) NodeImageUpdate2Digest ¶
NodeImageUpdate2Digest returns the manifest digest of the second update image.
func (*Env) NodeImageUpdate2DigestedPullSpec ¶
NodeImageUpdate2DigestedPullSpec returns the digest-qualified reference for the second update image (e.g. "registry.cluster.local:5000/node@sha256:789abc").
func (*Env) NodeImageUpdateDigest ¶
NodeImageUpdateDigest returns the manifest digest of the update image.
func (*Env) NodeImageUpdateDigestedPullSpec ¶
NodeImageUpdateDigestedPullSpec returns the digest-qualified reference for the update image (e.g. "registry.cluster.local:5000/node@sha256:def456").
func (*Env) RegistryPassword ¶
RegistryPassword returns the authenticated registry password, or empty if not configured.
func (*Env) RegistryUser ¶
RegistryUser returns the authenticated registry username, or empty if not configured.
func (*Env) TestLabels ¶
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.