e2e

package
v1.3.0-main Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

View Source
const (
	POLLING     = "250ms"
	POLLINGLONG = "1s"
	TIMEOUT     = "5m"
	LONGTIMEOUT = "10m"
)
View Source
const (
	ServiceAPI      = "flightctl-api"
	ServiceWorker   = "flightctl-worker"
	ServicePeriodic = "flightctl-periodic"
	ServiceUI       = "flightctl-ui"
	ServiceDB       = "flightctl-db"
)

Service name constants for flightctl deployment components.

View Source
const (
	OperationCreate = "create"
	OperationUpdate = "update"
	OperationGet    = "get"
	OperationList   = "list"
	OperationDelete = "delete"
	OperationAll    = "all"
)

Operation constants for RBAC testing

View Source
const (
	MicroshiftKubeconfigPath = "/var/lib/microshift/resources/kubeadmin/kubeconfig"
	MicroshiftPullSecretPath = "/etc/crio/openshift-pull-secret" //nolint:gosec // G101: file path, not credentials
)
View Source
const E2ESetupAbortExitCode = 2

E2ESetupAbortExitCode is the exit code used when BeforeSuite setup fails (e.g. VM/base disk missing). CI should treat this as job FAILURE; exit 1 (test failures) is treated as UNSTABLE.

View Source
const E2ESetupAbortStderrMarker = "FLIGHTCTL_E2E_SETUP_ABORT=1"

E2ESetupAbortStderrMarker is written to stderr on setup abort so CI can detect it from logs.

View Source
const (
	// QuadletUnitPath is the quadlet unit path on device (rootful)
	QuadletUnitPath = "/etc/containers/systemd"
)
View Source
const RemoteRepositoryEmptyMessage = "remote repository is empty"

Variables

View Source
var (
	// ErrLogStreamTimeout indicates the log stream timed out before completion
	ErrLogStreamTimeout = errors.New("log stream timeout")
	// ErrLogStreamUnexpectedClose indicates the stream closed without completion marker
	ErrLogStreamUnexpectedClose = errors.New("log stream closed unexpectedly")
)

Log stream errors

View Source
var (
	InvalidRenderedVersionErr = fmt.Errorf("invalid rendered version")
)

Functions

func BuildAppSpec added in v1.1.0

func BuildAppSpec(appName string, appType v1beta1.AppType, provider any) (v1beta1.ApplicationProviderSpec, error)

func BuildComposeWithImageVolumeSpec added in v1.1.0

func BuildComposeWithImageVolumeSpec(appName, composePath, composeContent, volumeName, imageRef string) (v1beta1.ApplicationProviderSpec, error)

BuildComposeWithImageVolumeSpec builds a compose ApplicationProviderSpec with inline compose content and a single image-backed application volume.

func BuildImageAppSpec added in v1.1.0

func BuildImageAppSpec(appName string, appType v1beta1.AppType, image string) (v1beta1.ApplicationProviderSpec, error)

func BuildInlineAppSpec added in v1.1.0

func BuildInlineAppSpec(appName string, appType v1beta1.AppType, contents []InlineContent) (v1beta1.ApplicationProviderSpec, error)

func Cleanup added in v0.10.0

func Cleanup(h *Harness)

Cleanup performs standard harness cleanup and removes VMs from the global pool This should be used for rollout tests and other scenarios where VMs are created with custom worker IDs

func ClearDeviceApplications added in v1.1.0

func ClearDeviceApplications(device *v1beta1.Device)

ClearDeviceApplications is a device update callback that removes all applications from the device spec.

func ConditionExists added in v0.7.0

func ConditionExists(d *v1beta1.Device, condType v1beta1.ConditionType, condStatus v1beta1.ConditionStatus, condReason string) bool

ConditionExists checks if a specific condition exists for the device with the given type, status, and reason.

func ConditionStatusExists added in v0.9.0

func ConditionStatusExists(conditions []v1beta1.Condition, condType v1beta1.ConditionType, status v1beta1.ConditionStatus) bool

ConditionStatusExists returns true if the specified type and status exists on the condition slice

func CreateFailingServiceOnDevice added in v1.0.0

func CreateFailingServiceOnDevice(h *Harness, serviceName string) error

func CreateFreshVMWithTPM added in v1.2.0

func CreateFreshVMWithTPM(workerID int, tempDir string, sshPortBase int, tpmDevice string) (vm.TestVMInterface, error)

CreateFreshVMWithTPM creates a fresh VM with TPM device passthrough. The VM is returned with the agent stopped so TPM configuration can be applied before starting. Unlike regular fresh VMs, TPM passthrough VMs are not cached in the pool since they depend on external hardware state.

func CreateInlineApplicationSpec added in v1.1.0

func CreateInlineApplicationSpec(inlineAppComposeYaml, filename string) v1beta1.InlineApplicationProviderSpec

CreateInlineApplicationSpec builds an inline application provider spec from compose yaml content.

func DeviceVulnerabilitySortByPtr added in v1.2.0

func DeviceVulnerabilitySortByPtr(s string) *v1alpha1.GetDeviceVulnerabilitiesParamsSortBy

DeviceVulnerabilitySortByPtr converts a string to a GetDeviceVulnerabilitiesParamsSortBy pointer.

func DeviceVulnerabilitySortOrderPtr added in v1.2.0

func DeviceVulnerabilitySortOrderPtr(s string) *v1alpha1.GetDeviceVulnerabilitiesParamsOrder

DeviceVulnerabilitySortOrderPtr converts a string to a GetDeviceVulnerabilitiesParamsOrder pointer.

func ErrUnlessHTTPForbidden added in v1.2.0

func ErrUnlessHTTPForbidden(err error, desc string) error

ErrUnlessHTTPForbidden returns nil if err is a non-nil *APIError with HTTP 403 Forbidden. It's used in tests that expect an action to be denied. Otherwise returns a descriptive error.

func ExecuteReadOnlyResourceOperations added in v0.10.0

func ExecuteReadOnlyResourceOperations(harness *Harness, resourceTypes []string, shouldSucceed bool) error

ExecuteReadOnlyResourceOperations tests read-only operations for the given resource types shouldSucceed determines whether the operations are expected to succeed or fail

func ExecuteResourceOperations added in v0.10.0

func ExecuteResourceOperations(ctx context.Context, harness *Harness, resourceTypes []string, shouldSucceed bool, testLabels *map[string]string, namespace string, operations []string) error

ExecuteResourceOperations tests all CRUD operations for the given resource types shouldSucceed determines whether the operations are expected to succeed or fail

func ExtractAuthURL added in v1.0.0

func ExtractAuthURL(provider *v1beta1.AuthProvider) string

ExtractAuthURL extracts the authentication URL from an AuthProvider based on its type

func GetBaseDiskPath added in v0.10.0

func GetBaseDiskPath() (string, error)

GetBaseDiskPath finds the base qcow2 disk path

func GetContainerApplicationImage added in v1.2.0

func GetContainerApplicationImage(spec v1beta1.ApplicationProviderSpec) (string, error)

GetContainerApplicationImage returns the image reference from a ContainerApplication spec.

func GetContainerApplicationVolumeImageRef added in v1.2.0

func GetContainerApplicationVolumeImageRef(spec v1beta1.ApplicationProviderSpec, volumeName string) (string, error)

GetContainerApplicationVolumeImageRef returns the image reference of the named volume in a ContainerApplication spec.

func GetDeviceConfig added in v0.6.0

func GetDeviceConfig[T any](device *v1beta1.Device, configType v1beta1.ConfigProviderType,
	asConfig func(v1beta1.ConfigProviderSpec) (T, error)) (T, error)

GetDeviceConfig is a generic helper function to retrieve device configurations

func GetQuadletApplicationInlineContent added in v1.2.0

func GetQuadletApplicationInlineContent(spec v1beta1.ApplicationProviderSpec) (string, error)

GetQuadletApplicationInlineContent returns the first inline content string from a QuadletApplication (inline provider).

func GetRenderedVersion added in v0.9.0

func GetRenderedVersion(device *v1beta1.Device) (int, error)

func GetTestDataPath added in v1.1.0

func GetTestDataPath(relativePath string) string

getTestDataPath returns the path to a file/directory in the testdata folder. Note: ginkgo runs tests from the test package directory (e.g. resourcesync test runs from test/e2e/resourcesync/).

func GetWorkerContext added in v0.10.0

func GetWorkerContext() context.Context

GetWorkerContext retrieves the context for the current worker.

func GinkgoBeforeSuite added in v0.10.0

func GinkgoBeforeSuite()

GinkgoBeforeSuite is a convenience function that sets up worker harness in BeforeSuite. Use this in your test suite's BeforeSuite if you want a simple setup.

func HasEventWithReason added in v1.2.0

func HasEventWithReason(events []v1beta1.Event, reason v1beta1.EventReason) bool

HasEventWithReason checks if the event list contains an event with the specified reason.

func HasEventWithReasonAndCVE added in v1.2.0

func HasEventWithReasonAndCVE(events []v1beta1.Event, reason v1beta1.EventReason, cveID string) bool

HasEventWithReasonAndCVE checks if the event list contains an event with the specified reason and a message containing the CVE ID.

func HaveReason added in v0.10.0

func HaveReason(expected string) types.GomegaMatcher

HaveReason returns a type-safe Gomega matcher for the Condition's Reason field.

func HaveStatus added in v0.10.0

func HaveStatus(expected v1beta1.ConditionStatus) types.GomegaMatcher

HaveStatus returns a type-safe Gomega matcher for the Condition's Status field.

func HostHasTPMDevice added in v1.2.0

func HostHasTPMDevice(device string) bool

HostHasTPMDevice returns true if the specified TPM device exists on the host.

func IsDeviceUpToDate added in v1.1.0

func IsDeviceUpToDate(device *v1beta1.Device) bool

IsDeviceUpToDate returns true if the device status indicates it is up to date.

func IsDeviceUpdateObserved added in v1.0.0

func IsDeviceUpdateObserved(device *v1beta1.Device, expectedVersion int) bool

IsDeviceUpdateObserved returns true if the device is updating or has already updated to the expected version.

func IsUpdatingConditionCleared added in v1.1.0

func IsUpdatingConditionCleared(device *v1beta1.Device) bool

IsUpdatingConditionCleared returns true if the device has no Updating condition in error state (Reason != "Error").

func NewComposeInlineSpec added in v1.2.0

func NewComposeInlineSpec(name, path, content, runAs string) (v1beta1.ApplicationProviderSpec, error)

NewComposeInlineSpec builds an ApplicationProviderSpec for a compose app from a single inline file.

func NewContainerApplicationSpec added in v1.1.0

func NewContainerApplicationSpec(
	name string,
	image string,
	ports []v1beta1.ApplicationPort,
	cpu, memory *string,
	volumes *[]v1beta1.ApplicationVolume,
) (v1beta1.ApplicationProviderSpec, error)

NewContainerApplicationSpec creates a ContainerApplication spec with the given parameters (runs as root).

func NewContainerApplicationSpecWithRunAs added in v1.2.0

func NewContainerApplicationSpecWithRunAs(
	name string,
	image string,
	ports []v1beta1.ApplicationPort,
	cpu, memory *string,
	volumes *[]v1beta1.ApplicationVolume,
	runAs string,
) (v1beta1.ApplicationProviderSpec, error)

NewContainerApplicationSpecWithRunAs creates a ContainerApplication spec with the given parameters and optional runAs user.

func NewHelmApplicationSpec added in v1.2.0

func NewHelmApplicationSpec(name, image, namespace string, valuesFiles []string) (v1beta1.ApplicationProviderSpec, error)

NewHelmApplicationSpec creates a HelmApplication spec with optional values files.

func NewHelmApplicationSpecWithValues added in v1.2.0

func NewHelmApplicationSpecWithValues(name, image, namespace string, values map[string]any) (v1beta1.ApplicationProviderSpec, error)

NewHelmApplicationSpecWithValues creates a HelmApplication spec with inline values.

func NewImageBuildSpec added in v1.1.0

func NewImageBuildSpec(sourceRepo, sourceImage, sourceTag, destRepo, destImage, destTag string, bindingType imagebuilderapi.BindingType) imagebuilderapi.ImageBuildSpec

NewImageBuildSpec creates a new ImageBuildSpec with the given parameters.

func NewImageBuildSpecWithUserConfig added in v1.1.0

func NewImageBuildSpecWithUserConfig(sourceRepo, sourceImage, sourceTag, destRepo, destImage, destTag string, bindingType imagebuilderapi.BindingType, username, publicKey string) imagebuilderapi.ImageBuildSpec

NewImageBuildSpecWithUserConfig creates a new ImageBuildSpec with the given parameters and optional user configuration. If username and publicKey are provided, they will be set as the user configuration for the build.

func NewImageExportSpec added in v1.1.0

func NewImageExportSpec(imageBuildName string, format imagebuilderapi.ExportFormatType) imagebuilderapi.ImageExportSpec

NewImageExportSpec creates a new ImageExportSpec from an ImageBuild reference.

func NewImageVolume added in v1.2.0

func NewImageVolume(name, imageRef string) (v1beta1.ApplicationVolume, error)

NewImageVolume returns an ApplicationVolume backed by an image.

func NewInlineConfigSpec added in v1.2.0

func NewInlineConfigSpec(name string, files []v1beta1.FileSpec) (v1beta1.ConfigProviderSpec, error)

NewInlineConfigSpec creates an InlineConfigProviderSpec with the given files.

func NewMountVolume added in v1.1.0

func NewMountVolume(name, mountPath string) (v1beta1.ApplicationVolume, error)

NewMountVolume creates a named volume mount for container apps

func NewQuadletApplicationSpec added in v1.2.0

func NewQuadletApplicationSpec(name, image, runAs string, envVars map[string]string, volumes ...v1beta1.ApplicationVolume) (v1beta1.ApplicationProviderSpec, error)

NewQuadletApplicationSpec creates a QuadletApplication spec with image provider.

func NewQuadletInlineSpec added in v1.2.0

func NewQuadletInlineSpec(name, runAs string, paths, contents []string) (v1beta1.ApplicationProviderSpec, error)

NewQuadletInlineSpec builds an ApplicationProviderSpec for a quadlet app from inline paths and contents.

func NewQuadletInlineSpecWithEnvs added in v1.2.0

func NewQuadletInlineSpecWithEnvs(name, runAs string, envVars map[string]string, paths, contents []string) (v1beta1.ApplicationProviderSpec, error)

NewQuadletInlineSpecWithEnvs builds an ApplicationProviderSpec for a quadlet app with inline content and env vars.

func NewQuadletInlineSpecWithVolumes added in v1.2.0

func NewQuadletInlineSpecWithVolumes(name, runAs string, volumes *[]v1beta1.ApplicationVolume, paths, contents []string) (v1beta1.ApplicationProviderSpec, error)

NewQuadletInlineSpecWithVolumes builds an ApplicationProviderSpec for a quadlet app with inline content and optional volumes.

func NewRBACImageBuildSpec added in v1.2.0

func NewRBACImageBuildSpec(sourceRepoName, destRepoName, testID, sourceImageName, sourceImageTag, destImageName string) imagebuilderapi.ImageBuildSpec

NewRBACImageBuildSpec builds an ImageBuildSpec for imagebuild RBAC tests

func ParseMetricValue added in v1.2.0

func ParseMetricValue(metricsOutput, metricName string) string

ParseMetricValue extracts the value of a Prometheus metric line from the metrics output. For a metric like `foo{label="val"} 42`, pass the full metric name with labels as the metricName parameter.

func QuadletPathForUser added in v1.2.0

func QuadletPathForUser(user string) string

QuadletPathForUser returns the quadlet systemd path for the given user. Empty or "root" returns the root path; any other user returns the user's config path.

func RemoveSystemdService added in v1.0.0

func RemoveSystemdService(h *Harness, serviceName string) error

RemoveSystemdService disables and removes a systemd unit file on the device and reloads systemd.

func RemoveVMFromPool added in v0.10.0

func RemoveVMFromPool(workerID int) error

RemoveVMFromPool removes a VM from the global pool for the given worker ID Note: This should be called AFTER harness.Cleanup() which handles VM destruction

func RestoreServiceOnDevice added in v1.0.0

func RestoreServiceOnDevice(h *Harness, serviceName string) error

func SetDeviceConfig added in v1.1.0

func SetDeviceConfig(configs ...v1beta1.ConfigProviderSpec) func(*v1beta1.Device)

SetDeviceConfig returns a device update callback that replaces the device config with the given specs.

func SetupFreshVMForWorker added in v1.1.0

func SetupFreshVMForWorker(workerID int, tempDir string, sshPortBase int) (vm.TestVMInterface, error)

SetupFreshVMForWorker is a convenience function that initializes the VM pool and returns a fresh VM. Fresh VMs use qcow2 overlays (like regular VMs) but don't create snapshots. This is useful for tests that need completely clean VMs without snapshot complexity.

func SetupVMForWorker added in v0.10.0

func SetupVMForWorker(workerID int, tempDir string, sshPortBase int) (vm.TestVMInterface, error)

SetupVMForWorker is a convenience function that initializes the VM pool and returns a VM for the worker. VMs are created on-demand if they don't already exist in the pool.

func StopServiceOnDevice added in v1.0.0

func StopServiceOnDevice(h *Harness, serviceName string) error

func TestResourceOperations added in v1.1.0

func TestResourceOperations(ctx context.Context, harness *Harness, operations []string, testConfigs []ResourceTestConfig, testLabels *map[string]string, namespace string) error

TestResourceOperations tests multiple resource groups with different success expectations. It iterates through testConfigs and calls ExecuteResourceOperations for each group.

func UpdateDeviceApplicationFromInline added in v1.1.0

func UpdateDeviceApplicationFromInline(device *v1beta1.Device, appName string, inlineApp v1beta1.InlineApplicationProviderSpec) error

UpdateDeviceApplicationFromInline updates or appends an inline application spec on the device.

func VulnerabilitySortByPtr added in v1.2.0

func VulnerabilitySortByPtr(s string) *v1alpha1.ListVulnerabilitiesParamsSortBy

VulnerabilitySortByPtr converts a string to a ListVulnerabilitiesParamsSortBy pointer.

func VulnerabilitySortOrderPtr added in v1.2.0

func VulnerabilitySortOrderPtr(s string) *v1alpha1.ListVulnerabilitiesParamsOrder

VulnerabilitySortOrderPtr converts a string to a ListVulnerabilitiesParamsOrder pointer.

func WriteEvidence added in v1.1.0

func WriteEvidence(dir, filename, command, output string, err error) error

Types

type APIError added in v1.1.0

type APIError struct {
	// StatusCode is the HTTP status code returned by the API.
	StatusCode int
	// Status is the parsed API status body (nil if the body could not be parsed).
	Status *v1beta1.Status
	// Resource describes the resource type being operated on (e.g., "ImageBuild").
	Resource string
	// ResourceName is the name of the resource being operated on.
	ResourceName string
}

APIError is a structured error returned by harness methods when the API responds with a non-success HTTP status code. It preserves the status code and the parsed v1beta1.Status body from the API response, enabling callers to use errors.As for precise error inspection instead of substring matching.

func (*APIError) Error added in v1.1.0

func (e *APIError) Error() string

Error implements the error interface.

func (*APIError) IsStatusCode added in v1.1.0

func (e *APIError) IsStatusCode(code int) bool

IsStatusCode returns true if the error has the given HTTP status code.

type BackupRestore added in v1.2.0

type BackupRestore struct {
	*Harness
	// contains filtered or unexported fields
}

BackupRestore performs backup/restore operations. Create with Harness.NewBackupRestore.

func (*BackupRestore) RunFlightCtlBackup added in v1.2.0

func (br *BackupRestore) RunFlightCtlBackup() (archivePath string, cleanup func(), err error)

RunFlightCtlBackup runs the flightctl-backup binary. Credentials are read directly from the cluster (K8s Secrets or /etc/flightctl/service-config.yaml for Podman). Returns the path to the generated archive and a cleanup function that removes the work directory.

func (*BackupRestore) RunFlightCtlRestore added in v1.2.0

func (br *BackupRestore) RunFlightCtlRestore(archivePath string) error

RunFlightCtlRestore runs the flightctl-restore binary with the given archive path. The binary reads credentials from the cluster and handles service stop/start internally.

func (*BackupRestore) ScaleUpFlightCtlServices added in v1.2.0

func (br *BackupRestore) ScaleUpFlightCtlServices() error

ScaleUpFlightCtlServices scales API, worker, periodic, alert-exporter, and alertmanager-proxy back up to 1 replica. Used as a safety net after restore in case the binary is killed before its own deferred startup.

type ConsoleSession added in v0.9.0

type ConsoleSession struct {
	Stdin  io.WriteCloser
	Stdout *Buffer
	// contains filtered or unexported fields
}

ConsoleSession represents a PTY console session to a device

func (*ConsoleSession) Close added in v0.9.0

func (cs *ConsoleSession) Close()

Close terminates the console session. When SkipGracefulExitOnClose was set (e.g. after "~."), it only closes stdin/stdout without sending "exit".

func (*ConsoleSession) MustExpect added in v0.9.0

func (cs *ConsoleSession) MustExpect(pattern string)

MustExpect waits for a pattern to appear in the console output

func (*ConsoleSession) MustSend added in v0.9.0

func (cs *ConsoleSession) MustSend(cmd string)

MustSend sends a command to the console session

func (*ConsoleSession) SkipGracefulExitOnClose added in v1.2.0

func (cs *ConsoleSession) SkipGracefulExitOnClose()

When called set Close function not to send the "exit" command before disconnecting the client (e.g. flightctl "~." escape) and only release local PTY fds.

type GitServerConfig added in v0.10.0

type GitServerConfig struct {
	Host string
	Port int
	User string
}

GitServerConfig holds configuration for the git server. Callers get it from infra (e.g. auxiliary).

type Harness

type Harness struct {
	Client             *apiclient.ClientWithResponses
	ImageBuilderClient *client.ImageBuilderClient
	Context            context.Context

	VM vm.TestVMInterface
	// contains filtered or unexported fields
}

func GetWorkerHarness added in v0.10.0

func GetWorkerHarness() *Harness

GetWorkerHarness retrieves the harness for the current worker. This should be called from your test suite's BeforeEach or tests.

func NewTestHarnessWithFreshVMFromPool added in v1.1.0

func NewTestHarnessWithFreshVMFromPool(ctx context.Context, workerID int) (*Harness, error)

NewTestHarnessWithFreshVMFromPool creates a harness with a fresh VM from the pool. Fresh VMs use full disk copies instead of overlays and don't use snapshots. The VM is managed by the pool but provides completely clean state for each test.

func NewTestHarnessWithVMPool added in v0.10.0

func NewTestHarnessWithVMPool(ctx context.Context, workerID int) (*Harness, error)

NewTestHarnessWithVMPool creates a new test harness with VM pool management. This centralizes the VM pool logic that was previously duplicated in individual tests.

func NewTestHarnessWithoutVM added in v0.10.0

func NewTestHarnessWithoutVM(ctx context.Context) (*Harness, error)

NewTestHarnessWithoutVM creates a new test harness without VM management.

func SetupWorkerHarness added in v0.10.0

func SetupWorkerHarness() (*Harness, context.Context, error)

SetupWorkerHarness sets up a VM and harness for the current worker. This should be called in BeforeSuite.

func SetupWorkerHarnessOrAbort added in v1.2.0

func SetupWorkerHarnessOrAbort() (*Harness, context.Context)

SetupWorkerHarnessOrAbort calls SetupWorkerHarness and exits the process on error. Use in BeforeSuite when a VM is required; the job fails immediately on env problems (e.g. base disk not found) so no specs run. Exits with E2ESetupAbortExitCode (2) and prints E2ESetupAbortStderrMarker so CI can report FAILURE (not UNSTABLE). Test failures use exit 1.

func SetupWorkerHarnessWithoutVM added in v1.1.0

func SetupWorkerHarnessWithoutVM() (*Harness, context.Context, error)

SetupWorkerHarnessWithoutVM sets up a harness for the current worker without VM. This is useful for tests that only need API access and don't require a device/agent VM. This should be called in BeforeSuite.

func (*Harness) AddConfigToDeviceWithRetries added in v0.9.0

func (h *Harness) AddConfigToDeviceWithRetries(deviceId string, config v1beta1.ConfigProviderSpec) error

func (*Harness) AddLabelsToYAML added in v0.10.0

func (h *Harness) AddLabelsToYAML(yamlContent string, addLabels map[string]string) (string, error)

TODO: Modify addTestLabelsToYAML to include other labels and remove addLabelsToYAML

func (*Harness) AdminProvisionRBACImageBuildExport added in v1.2.0

func (h *Harness) AdminProvisionRBACImageBuildExport(sourceRepoName, destRepoName, namePrefix string, waitExportCompleted bool,
	sourceImageName, sourceImageTag, destImageName string,
) (
	imageBuildName, imageExportName string,
	imageBuildSpec imagebuilderapi.ImageBuildSpec,
	exportSpec imagebuilderapi.ImageExportSpec,
	err error,
)

AdminProvisionRBACImageBuildExport creates one ImageBuild and one ImageExport as admin.

func (*Harness) ApiEndpoint

func (h *Harness) ApiEndpoint() string

func (*Harness) ApplyResource added in v0.10.0

func (h *Harness) ApplyResource(yamlPath string) (string, error)

func (*Harness) ApplyTempIfSuggested added in v1.0.0

func (h *Harness) ApplyTempIfSuggested(out string, cliErr error) error

ApplyTempIfSuggested looks for "Your changes have been saved to:" in CLI output. If found, it automatically applies the saved file to complete the edit flow.

func (*Harness) ApproveEnrollment

func (h *Harness) ApproveEnrollment(id string, approval *v1beta1.EnrollmentRequestApproval)

func (*Harness) ApproveEnrollmentRequestWithLabels added in v1.2.0

func (h *Harness) ApproveEnrollmentRequestWithLabels(enrollmentID string, labels map[string]string) (int, error)

ApproveEnrollmentRequestWithLabels approves an EnrollmentRequest and returns the HTTP status code.

func (*Harness) BlockTrafficOnVM added in v1.2.0

func (h *Harness) BlockTrafficOnVM(ip, port string)

BlockTrafficOnVM adds an iptables/ip6tables rule on the VM to reject TCP traffic to the specified IP and port. Automatically detects IPv4 vs IPv6 and uses the appropriate command.

func (*Harness) CLI

func (h *Harness) CLI(args ...string) (string, error)

func (*Harness) CLIWithEnvAndShell added in v0.10.0

func (h *Harness) CLIWithEnvAndShell(env map[string]string, shellCommand string) (string, error)

CLIWithEnvAndShell runs a shell command with custom environment variables (for complex commands with pipes)

func (*Harness) CLIWithStdin

func (h *Harness) CLIWithStdin(stdin string, args ...string) (string, error)

func (*Harness) CancelImageBuild added in v1.1.0

func (h *Harness) CancelImageBuild(name string) error

CancelImageBuild cancels an in-progress ImageBuild.

func (*Harness) CancelImageExport added in v1.1.0

func (h *Harness) CancelImageExport(name string) error

CancelImageExport cancels an in-progress ImageExport.

func (*Harness) CaptureDeploymentLogs added in v1.2.0

func (h *Harness) CaptureDeploymentLogs(artifactDir string) error

CaptureDeploymentLogs fetches logs from the flightctl deployment services and stores each as an artifact file in the given directory. In Kubernetes environments, services are discovered dynamically via the

func (*Harness) CaptureDeploymentLogsIfFailed added in v1.2.0

func (h *Harness) CaptureDeploymentLogsIfFailed()

CaptureDeploymentLogsIfFailed captures deployment pod logs to the artifacts directory when the current test has failed. Intended to be called from AfterEach alongside PrintAgentLogsIfFailed.

func (*Harness) CaptureHostCLI added in v1.1.0

func (h *Harness) CaptureHostCLI(artifactDir, filename string, args ...string) error

CaptureHostCLI runs flightctl on the host and writes evidence.

func (*Harness) CaptureStandardEvidence added in v1.1.0

func (h *Harness) CaptureStandardEvidence(artifactDir, deviceID string) error

CaptureStandardEvidence records common evidence files for pruning scenarios.

func (*Harness) CaptureVMCommand added in v1.1.0

func (h *Harness) CaptureVMCommand(artifactDir, filename, command string, optional bool) error

CaptureVMCommand runs a VM command and writes evidence.

func (*Harness) CheckApplicationComposeFileExist added in v0.8.0

func (h *Harness) CheckApplicationComposeFileExist(applicationName string, ComposeFile string) error

func (*Harness) CheckApplicationDirectoryExist added in v0.8.0

func (h *Harness) CheckApplicationDirectoryExist(applicationName string) error

func (Harness) CheckApplicationStatus added in v0.8.0

func (h Harness) CheckApplicationStatus(deviceId string, applicationName string) (v1beta1.ApplicationStatusType, error)

func (*Harness) CheckDeviceStatus added in v0.6.0

func (h *Harness) CheckDeviceStatus(deviceId string, status v1beta1.DeviceSummaryStatusType) (*v1beta1.Device, error)

Check that the device summary status is equal to the status input

func (*Harness) CheckEnvInjectedToApplication added in v0.8.0

func (h *Harness) CheckEnvInjectedToApplication(envVarName string, image string) (string, error)

func (*Harness) CheckFleetControllerErrorAnnotation added in v1.2.0

func (h *Harness) CheckFleetControllerErrorAnnotation(deviceId, expectedKeySubstring string) error

CheckFleetControllerErrorAnnotation verifies that the device has the fleet controller error annotation set and that it contains the expected key substring. Returns an error suitable for use inside Eventually blocks for retryable polling.

func (*Harness) CheckRunningContainers added in v0.7.0

func (h *Harness) CheckRunningContainers() (string, error)

CheckRunningContainers verifies the expected number of running containers on the VM.

func (*Harness) CleanUpAllTestResources added in v0.10.0

func (h *Harness) CleanUpAllTestResources() error

func (*Harness) CleanUpResource added in v0.10.0

func (h *Harness) CleanUpResource(resourceType string, resourceName string) (string, error)

func (*Harness) CleanUpTestResources added in v0.10.0

func (h *Harness) CleanUpTestResources(resourceTypes ...string) error

CleanUpTestResources deletes only resources that have the test label for the current test

func (*Harness) Cleanup

func (h *Harness) Cleanup(printConsole bool)

Harness cleanup, this will delete the VM and cancel the context if something failed we try to gather logs, console logs are optional and can be enabled by setting printConsole to true

func (*Harness) CleanupGitRepositories added in v0.10.0

func (h *Harness) CleanupGitRepositories(config GitServerConfig, keyPath util.SSHPrivateKeyPath) error

CleanupGitRepositories removes all git repositories created by the harness. Callers pass the same config and keyPath used when creating repos.

func (*Harness) CloneGitRepositoryFromServer added in v0.10.0

func (h *Harness) CloneGitRepositoryFromServer(config GitServerConfig, keyPath util.SSHPrivateKeyPath, repoName, localPath string) error

CloneGitRepositoryFromServer clones a repository from the git server to a local working directory.

func (*Harness) CommitAndPushGitRepo added in v1.1.0

func (h *Harness) CommitAndPushGitRepo(workDir string, keyPath util.SSHPrivateKeyPath, commitMessage string) error

CommitAndPushGitRepo commits all changes in a local git working directory and pushes to the remote. keyPath must be the path to the git SSH private key (caller gets it from infra).

func (*Harness) CopyAgentFile added in v1.2.0

func (h *Harness) CopyAgentFile(sourcePath, destinationPath string) error

CopyAgentFile copies a file on the VM using sudo cp.

func (*Harness) CountDevicesByLabel added in v1.2.0

func (h *Harness) CountDevicesByLabel(testID string) int

CountDevicesByLabel returns the number of devices matching the given test-id label.

func (*Harness) CreateAgentDropIn added in v1.2.0

func (h *Harness) CreateAgentDropIn(filename, content string) error

CreateAgentDropIn creates a systemd drop-in file for the flightctl-agent service.

func (*Harness) CreateCloudInitDir added in v1.1.0

func (h *Harness) CreateCloudInitDir(tempDir, vmName, agentConfig string) (string, error)

CreateCloudInitDir creates a cloud-init directory with user-data and meta-data files. The agentConfig is base64-encoded and written to /etc/flightctl/config.yaml on the VM. Returns the path to the cloud-init directory.

func (*Harness) CreateDeviceConfigInGitRepo added in v0.10.0

func (h *Harness) CreateDeviceConfigInGitRepo(config GitServerConfig, keyPath util.SSHPrivateKeyPath, repoName, deviceName string, deviceSpec v1beta1.DeviceSpec) error

CreateDeviceConfigInGitRepo creates a device configuration and pushes it to a git repository.

func (*Harness) CreateDeviceWithDigest added in v1.2.0

func (h *Harness) CreateDeviceWithDigest(deviceName, fleetName, digest string) error

CreateDeviceWithDigest creates a device with the specified OS image digest for vulnerability testing. It creates the device first, then updates its status with the OS image digest. Uses resourceVersion for optimistic locking and retries on conflict.

func (*Harness) CreateFleetConfigInGitRepo added in v0.10.0

func (h *Harness) CreateFleetConfigInGitRepo(config GitServerConfig, keyPath util.SSHPrivateKeyPath, repoName, fleetName string, fleetSpec v1beta1.FleetSpec) error

CreateFleetConfigInGitRepo creates a fleet configuration and pushes it to a git repository.

func (*Harness) CreateFleetDeviceSpec added in v0.8.1

func (h *Harness) CreateFleetDeviceSpec(registryHost, registryPort, deviceImageTag string, additionalConfigs ...v1beta1.ConfigProviderSpec) (v1beta1.DeviceSpec, error)

CreateFleetDeviceSpec builds a device spec. Pass registryHost and registryPort from auxiliary for Os.Image; when deviceImageTag is empty they are unused.

func (*Harness) CreateFleetWithInlineComposeAndVolumes added in v1.2.0

func (h *Harness) CreateFleetWithInlineComposeAndVolumes(
	fleetName string,
	selectorValue string,
	appName string,
	composePath string,
	composeContent string,
	volumes []InlineComposeVolume,
) error

CreateFleetWithInlineComposeAndVolumes creates or updates a fleet with a single inline compose application and optional image volumes.

func (*Harness) CreateFleetWithSelector added in v1.2.0

func (h *Harness) CreateFleetWithSelector(fleetName string, labelSelector map[string]string) error

CreateFleetWithSelector creates a fleet with the specified label selector and empty device spec.

func (*Harness) CreateGitRepository added in v0.10.0

func (h *Harness) CreateGitRepository(config GitServerConfig, keyPath util.SSHPrivateKeyPath, repoName string, repositorySpec domain.RepositorySpec) error

CreateGitRepository creates a Repository resource pointing to the git server repository.

func (*Harness) CreateGitRepositoryNoAuth added in v1.1.0

func (h *Harness) CreateGitRepositoryNoAuth(name, url string) (*v1beta1.Repository, error)

CreateGitRepositoryNoAuth creates a Git repository without authentication.

func (*Harness) CreateGitRepositoryOnServer added in v0.10.0

func (h *Harness) CreateGitRepositoryOnServer(config GitServerConfig, keyPath util.SSHPrivateKeyPath, repoName string) error

CreateGitRepositoryOnServer creates a new Git repository on the e2e git server. Callers pass config and keyPath from infra (e.g. auxiliary).

func (*Harness) CreateGitRepositoryWithContent added in v0.10.0

func (h *Harness) CreateGitRepositoryWithContent(config GitServerConfig, keyPath util.SSHPrivateKeyPath, repoName, filePath, content string, repositorySpec v1beta1.RepositorySpec) error

CreateGitRepositoryWithContent creates a git repository with initial content. Callers pass config and keyPath from infra (e.g. auxiliary).

func (*Harness) CreateHTTPRepository added in v1.1.0

func (h *Harness) CreateHTTPRepository(name, url string, username, password *string) (*v1beta1.Repository, error)

CreateHTTPRepository creates an HTTP repository.

func (*Harness) CreateImageBuild added in v1.1.0

func (h *Harness) CreateImageBuild(name string, spec imagebuilderapi.ImageBuildSpec) (*imagebuilderapi.ImageBuild, error)

CreateImageBuild creates an ImageBuild resource with the given name and spec.

func (*Harness) CreateImageBuildWithLabels added in v1.1.0

func (h *Harness) CreateImageBuildWithLabels(name string, spec imagebuilderapi.ImageBuildSpec, labels map[string]string) (*imagebuilderapi.ImageBuild, error)

CreateImageBuildWithLabels creates an ImageBuild resource with the given name, spec, and labels.

func (*Harness) CreateImageExport added in v1.1.0

func (h *Harness) CreateImageExport(name string, spec imagebuilderapi.ImageExportSpec) (*imagebuilderapi.ImageExport, error)

CreateImageExport creates an ImageExport resource with the given name and spec.

func (*Harness) CreateOrUpdateTestFleet added in v0.6.0

func (h *Harness) CreateOrUpdateTestFleet(testFleetName string, fleetSpecOrSelector interface{}, deviceSpec ...v1beta1.DeviceSpec) error

Create a test fleet resource

func (*Harness) CreateRepository added in v0.6.0

func (h *Harness) CreateRepository(repositorySpec v1beta1.RepositorySpec, metadata v1beta1.ObjectMeta) error

Create a repository resource

func (*Harness) CreateRepositoryWithSSHCredentials added in v1.1.0

func (h *Harness) CreateRepositoryWithSSHCredentials(repoName, repoURL string, keyContent util.SSHPrivateKeyContent) error

CreateRepositoryWithSSHCredentials creates a Repository resource with SSH credentials. keyContent must be the raw SSH private key (e.g. from auxiliary.Get(ctx).GetGitSSHPrivateKey()).

func (*Harness) CreateRepositoryWithValidE2ECredentials added in v1.1.0

func (h *Harness) CreateRepositoryWithValidE2ECredentials(internalHost string, internalPort int, repoName string, keyContent util.SSHPrivateKeyContent) error

CreateRepositoryWithValidE2ECredentials creates a Repository resource using the E2E SSH key and the internal cluster URL. Callers pass internalHost, internalPort from infra (e.g. aux) and keyContent from infra (e.g. auxiliary.Get(ctx).GetGitSSHPrivateKey()).

func (*Harness) CreateResource added in v0.10.0

func (h *Harness) CreateResource(resourceType string) (string, string, []byte, error)

func (*Harness) CreateResourceSync added in v0.10.0

func (h *Harness) CreateResourceSync(name, repoName string, spec v1beta1.ResourceSyncSpec) error

CreateResourceSync creates a ResourceSync resource

func (*Harness) CreateResourceSyncForRepo added in v1.1.0

func (h *Harness) CreateResourceSyncForRepo(resourceSyncName, repoName, branchName string) error

func (*Harness) CreateTestFleetWithConfig added in v0.6.0

func (h *Harness) CreateTestFleetWithConfig(testFleetName string, testFleetSelector v1beta1.LabelSelector, configProviderSpec v1beta1.ConfigProviderSpec) error

CreateTestFleetWithConfig creates a test fleet with a configuration.

func (*Harness) CrictlImageExists added in v1.2.0

func (h *Harness) CrictlImageExists(imageSubstring string) (bool, error)

CrictlImageExists checks if an image matching the given substring exists in crictl images.

func (*Harness) DecommissionDevice added in v1.2.0

func (h *Harness) DecommissionDevice(deviceName string) (string, error)

DecommissionDevice runs the CLI decommission command for the given device name. Returns the CLI output and any error.

func (*Harness) DeleteCurrentEnrollmentRequestFromAgentLogs added in v1.2.0

func (h *Harness) DeleteCurrentEnrollmentRequestFromAgentLogs() error

DeleteCurrentEnrollmentRequestFromAgentLogs deletes the latest pending EnrollmentRequest identified in flightctl-agent logs. If no enrollment ID is present, it is a no-op.

func (*Harness) DeleteDeviceIgnoreNotFound added in v1.2.0

func (h *Harness) DeleteDeviceIgnoreNotFound(deviceName string) error

DeleteDeviceIgnoreNotFound deletes a device, ignoring 404 errors.

func (*Harness) DeleteFleet added in v0.9.0

func (h *Harness) DeleteFleet(testFleetName string) error

func (*Harness) DeleteFleetIgnoreNotFound added in v1.2.0

func (h *Harness) DeleteFleetIgnoreNotFound(fleetName string) error

DeleteFleetIgnoreNotFound deletes a fleet, ignoring 404 errors.

func (*Harness) DeleteGitRepositoryOnServer added in v0.10.0

func (h *Harness) DeleteGitRepositoryOnServer(config GitServerConfig, keyPath util.SSHPrivateKeyPath, repoName string) error

DeleteGitRepositoryOnServer deletes a Git repository from the e2e git server.

func (*Harness) DeleteImageBuild added in v1.1.0

func (h *Harness) DeleteImageBuild(name string) error

DeleteImageBuild deletes an ImageBuild resource by name.

func (*Harness) DeleteImageExport added in v1.1.0

func (h *Harness) DeleteImageExport(name string) error

DeleteImageExport deletes an ImageExport resource by name.

func (*Harness) DeleteRepository added in v0.9.0

func (h *Harness) DeleteRepository(name string) error

DeleteRepository deletes the specified repository

func (*Harness) DeleteResourceSync added in v0.10.0

func (h *Harness) DeleteResourceSync(name string) error

DeleteResourceSync deletes the specified ResourceSync

func (*Harness) DetectTPMType added in v1.2.0

func (h *Harness) DetectTPMType() (TPMType, error)

DetectTPMType determines whether the VM has a software TPM (swtpm) or real hardware TPM by querying the TPM manufacturer properties.

func (*Harness) DownloadImageExport added in v1.1.0

func (h *Harness) DownloadImageExport(name string) (io.ReadCloser, int64, error)

DownloadImageExport downloads an ImageExport artifact and returns the response body. The caller is responsible for closing the returned io.ReadCloser.

func (*Harness) DropinCleanupFunc added in v1.1.0

func (h *Harness) DropinCleanupFunc(artifactDir, filename, command string) func()

DropinCleanupFunc returns a cleanup func that removes a drop-in and records evidence.

func (*Harness) DumpVulnerabilityState added in v1.2.0

func (h *Harness) DumpVulnerabilityState(v1alpha1Client *v1alpha1client.ClientWithResponses, fleetName string, deviceNames ...string)

DumpVulnerabilityState prints comprehensive debug information about devices, fleets, and vulnerabilities. Useful for understanding the current system state during test debugging.

func (*Harness) EditWithRetry added in v1.0.0

func (h *Harness) EditWithRetry(format, editor, resource string) (string, error)

EditWithRetry runs: flightctl edit -o <format> --editor <editor> <resource> Retries briefly if the server responds with a Conflict (resourceVersion race).

func (*Harness) EnableAgentMetrics added in v1.2.0

func (h *Harness) EnableAgentMetrics() error

EnableAgentMetrics appends metrics-enabled: true to the agent config so the Prometheus /metrics endpoint is available for test validation.

func (*Harness) EnrollAndWaitForOnlineStatus added in v0.4.0

func (h *Harness) EnrollAndWaitForOnlineStatus(labels ...map[string]string) (string, *v1beta1.Device)

func (*Harness) EnrollDeviceForDecommissionTest added in v1.2.0

func (h *Harness) EnrollDeviceForDecommissionTest(loginFn LoginFunc, deviceCount int, enrollTimeout time.Duration) (string, *exec.Cmd, error)

EnrollDeviceForDecommissionTest starts a labeled simulator as the given user, waits for at least one device to enroll, and returns the name of the first enrolled device.

func (*Harness) EnsureArtifactDir added in v1.1.0

func (h *Harness) EnsureArtifactDir(testCase string) (string, error)

EnsureArtifactDir builds and creates the per-test artifact directory.

func (*Harness) EnsureDeviceContents added in v0.9.0

func (h *Harness) EnsureDeviceContents(deviceId string, description string, condition func(*v1beta1.Device) bool, timeout string)

EnsureDeviceContents ensures that the contents of the device match the specified condition for the entire timeout

func (*Harness) EnsureDeviceSimulatorBinary added in v1.1.0

func (h *Harness) EnsureDeviceSimulatorBinary() (string, error)

EnsureDeviceSimulatorBinary returns the path to the devicesimulator binary, building it if missing.

func (*Harness) EnsureMicroshiftConfigs added in v1.2.0

func (h *Harness) EnsureMicroshiftConfigs() error

func (*Harness) ExtractSingleContainerNameFromVM added in v1.1.0

func (h *Harness) ExtractSingleContainerNameFromVM() (string, error)

func (*Harness) FetchMetrics added in v1.1.0

func (h *Harness) FetchMetrics(url string) (string, error)

FetchMetrics fetches a Prometheus text metrics endpoint.

func (*Harness) FetchReferrers added in v1.2.0

func (h *Harness) FetchReferrers(registry, imageName, digest string) ([]ocispec.Descriptor, error)

FetchReferrers fetches all referrers for an image in an OCI registry. registry: the registry host (e.g., "localhost:5000") imageName: the image name (e.g., "myimage" or "namespace/myimage") digest: the image digest (e.g., "sha256:...") Returns the list of referrer descriptors.

func (*Harness) FetchSBOMContent added in v1.2.0

func (h *Harness) FetchSBOMContent(registry, imageName string, referrerDesc ocispec.Descriptor) ([]byte, error)

FetchSBOMContent fetches the SBOM content from the registry using the referrer descriptor. registry: the registry host (e.g., "localhost:5000") imageName: the image name (e.g., "myimage" or "namespace/myimage") referrerDesc: the descriptor of the SBOM referrer manifest Returns the raw SBOM JSON content.

func (*Harness) FixNetworkFailure added in v0.8.1

func (h *Harness) FixNetworkFailure(registryHost, registryPort string) error

FixNetworkFailure unblocks VM traffic to the given registry host:port and flushes DNS cache. Caller must pass the same registry host and port used in SimulateNetworkFailure.

func (*Harness) FixNetworkFailureForCLI added in v0.8.1

func (h *Harness) FixNetworkFailureForCLI(ip, port string) error

FixNetworkFailureForCLI removes an entry from iptables if it exists. returns an error if no entry for the ip:port combo exists

func (*Harness) FleetExists added in v1.1.0

func (h *Harness) FleetExists(fleetName string) bool

func (*Harness) GenerateEnrollmentConfig added in v1.1.0

func (h *Harness) GenerateEnrollmentConfig(csrName string) (string, error)

GenerateEnrollmentConfig generates enrollment certificates and agent config for late binding. Uses CLI to create the CSR (which handles key generation and certificate retrieval). The csrName parameter is used to name the certificate signing request (must be unique per test). Returns the agent config YAML content with embedded credentials.

func (*Harness) GenerateFleetYAMLsForSimulator added in v1.1.0

func (h *Harness) GenerateFleetYAMLsForSimulator(fleetCount, devicesPerFleet int, fleetBaseName string) (string, error)

GenerateFleetYAMLsForSimulator returns a multi-document Fleet YAML string with fleetCount Fleet objects, each selecting devices labeled with its fleet name, and annotates each Fleet with the desired devices-per-fleet count for clarity. fleetBaseName controls the base of the generated Fleet names (formatted as "<fleetBaseName>-%02d"). It validates inputs are positive and returns an error otherwise.

func (*Harness) GetAPIEndpointFromVM added in v1.2.0

func (h *Harness) GetAPIEndpointFromVM() (ip string, port string, err error)

GetAPIEndpointFromVM extracts the resolved API server IP and port from the agent config file on the VM (/etc/flightctl/config.yaml).

func (*Harness) GetAPIEndpointHostIPPortFromVM added in v1.2.0

func (h *Harness) GetAPIEndpointHostIPPortFromVM() (host string, ip string, port string, err error)

GetAPIEndpointHostIPPortFromVM extracts both the configured API hostname and the resolved destination IP plus port from the agent config file on the VM.

func (*Harness) GetAgentConfig added in v1.2.0

func (h *Harness) GetAgentConfig() (*agentcfg.Config, error)

GetAgentConfig reads and parses the agent configuration from the VM.

func (*Harness) GetAgentMetricValue added in v1.2.0

func (h *Harness) GetAgentMetricValue(metricName string) (string, error)

GetAgentMetricValue fetches the agent metrics and parses a single metric value in one step.

func (*Harness) GetAgentMetrics added in v1.2.0

func (h *Harness) GetAgentMetrics() (string, error)

GetAgentMetrics fetches the Prometheus metrics from the agent's metrics endpoint on the VM via SSH.

func (*Harness) GetAgentVersion added in v0.10.0

func (h *Harness) GetAgentVersion() (string, error)

GetAgentVersion returns the agent version from the flightctl-agent version command

func (*Harness) GetAgentVersionFromLogs added in v0.10.0

func (h *Harness) GetAgentVersionFromLogs() (string, error)

GetAgentVersionFromLogs returns the agent version from the flightctl-agent service logs

func (*Harness) GetCertificateSigningRequestByYaml added in v0.4.0

func (h *Harness) GetCertificateSigningRequestByYaml(csrYaml string) v1beta1.CertificateSigningRequest

Wrapper function for CertificateSigningRequest

func (*Harness) GetClientAccessToken added in v1.1.0

func (h *Harness) GetClientAccessToken() (string, error)

func (*Harness) GetContainerPorts added in v1.1.0

func (h *Harness) GetContainerPorts() (string, error)

GetContainerPorts returns the port mappings for running containers

func (*Harness) GetCrictlImages added in v1.2.0

func (h *Harness) GetCrictlImages() (string, error)

GetCrictlImages returns the output of crictl images command.

func (*Harness) GetCurrentDeviceGeneration added in v0.6.0

func (h *Harness) GetCurrentDeviceGeneration(deviceId string) (deviceRenderedVersionInt int64, err error)

func (*Harness) GetCurrentDeviceRenderedVersion added in v0.4.0

func (h *Harness) GetCurrentDeviceRenderedVersion(deviceId string) (int, error)

func (*Harness) GetCurrentUserPreferredUsername added in v1.2.0

func (h *Harness) GetCurrentUserPreferredUsername() (string, error)

GetCurrentUserPreferredUsername returns the preferred_username from the auth userinfo endpoint for the currently logged-in user.

func (*Harness) GetDefaultK8sContext added in v0.10.0

func (h *Harness) GetDefaultK8sContext() (string, error)

GetDefaultK8sContext returns the current kubectl context name.

func (*Harness) GetDevice added in v0.6.0

func (h *Harness) GetDevice(deviceId string) (*v1beta1.Device, error)

Get device with response

func (*Harness) GetDeviceByYaml added in v0.4.0

func (h *Harness) GetDeviceByYaml(deviceYaml string) v1beta1.Device

Wrapper function for Device

func (*Harness) GetDeviceEvents added in v1.2.0

func (h *Harness) GetDeviceEvents(deviceName string, reason *v1beta1.EventReason) ([]v1beta1.Event, error)

GetDeviceEvents retrieves events for a device, optionally filtered by reason.

func (*Harness) GetDeviceFromTestContext added in v0.10.0

func (h *Harness) GetDeviceFromTestContext() (string, *v1beta1.Device, bool)

GetDeviceFromTestContext retrieves device data from the test context

func (*Harness) GetDeviceGitConfig added in v0.6.0

func (h *Harness) GetDeviceGitConfig(device *v1beta1.Device, configName string) (v1beta1.GitConfigProviderSpec, error)

Get GitConfig

func (*Harness) GetDeviceHttpConfig added in v0.6.0

func (h *Harness) GetDeviceHttpConfig(device *v1beta1.Device, configName string) (v1beta1.HttpConfigProviderSpec, error)

Get HttpConfig

func (*Harness) GetDeviceImageRefForFleet added in v1.2.0

func (h *Harness) GetDeviceImageRefForFleet(registryHost, registryPort, deviceImageTag string) string

GetDeviceImageRefForFleet returns the device OS image reference to use in fleet/device spec. Pass registryHost and registryPort from auxiliary (e.g. auxiliary.Get(ctx).Registry.Host, .Registry.Port). if either is empty, returns the quay.io fallback.

func (*Harness) GetDeviceInlineConfig added in v0.6.0

func (h *Harness) GetDeviceInlineConfig(device *v1beta1.Device, configName string) (v1beta1.InlineConfigProviderSpec, error)

Get InlineConfig

func (*Harness) GetDeviceOsImage added in v0.6.0

func (h *Harness) GetDeviceOsImage(device *v1beta1.Device) (image string, err error)

Get an http config of a device resource

func (*Harness) GetDeviceRenderedAppRefs added in v1.2.0

func (h *Harness) GetDeviceRenderedAppRefs(deviceId, containerAppName, quadletAppName, inlineAppName string) (*RenderedAppRefs, error)

GetDeviceRenderedAppRefs extracts rendered application references from the device spec, matching apps by the given names. Pass empty string for any app name to skip extraction.

func (*Harness) GetDeviceSystemInfo added in v0.9.0

func (h *Harness) GetDeviceSystemInfo(deviceID string) *v1beta1.DeviceSystemInfo

GetDeviceSystemInfo returns the device system info with proper error handling

func (*Harness) GetDeviceVulnerabilities added in v1.2.0

func (h *Harness) GetDeviceVulnerabilities(v1alpha1Client *v1alpha1client.ClientWithResponses, deviceName string, params *v1alpha1.GetDeviceVulnerabilitiesParams) (*v1alpha1.VulnerabilityList, error)

GetDeviceVulnerabilities retrieves vulnerabilities for a specific device.

func (*Harness) GetDeviceVulnerabilitySummary added in v1.2.0

func (h *Harness) GetDeviceVulnerabilitySummary(v1alpha1Client *v1alpha1client.ClientWithResponses, deviceName string) (*v1alpha1.DeviceVulnerabilitySummaryResponse, error)

GetDeviceVulnerabilitySummary retrieves the vulnerability summary for a device.

func (*Harness) GetDeviceWithStatusSummary added in v0.4.0

func (h *Harness) GetDeviceWithStatusSummary(enrollmentID string) (v1beta1.DeviceSummaryStatusType, error)

func (*Harness) GetDeviceWithStatusSystem

func (h *Harness) GetDeviceWithStatusSystem(enrollmentID string) (*apiclient.GetDeviceResponse, error)

func (*Harness) GetDeviceWithUpdateStatus added in v0.4.0

func (h *Harness) GetDeviceWithUpdateStatus(enrollmentID string) (v1beta1.DeviceUpdatedStatusType, error)

func (*Harness) GetDirectClusterToken added in v1.2.0

func (h *Harness) GetDirectClusterToken() (string, error)

GetDirectClusterToken returns the current cluster token from the active oc context.

func (*Harness) GetEnrollmentIDFromServiceLogs added in v0.10.0

func (h *Harness) GetEnrollmentIDFromServiceLogs(serviceName string) string

GetEnrollmentIDFromServiceLogs returns the enrollment ID from the service logs using journalctl. This is more reliable than console output as it captures service output regardless of how the service is started.

func (*Harness) GetEnrollmentRequestByYaml added in v0.4.0

func (h *Harness) GetEnrollmentRequestByYaml(erYaml string) *v1beta1.EnrollmentRequest

Wrapper function for EnrollmentRequest

func (*Harness) GetFleet added in v0.9.0

func (h *Harness) GetFleet(fleetName string) (*v1beta1.Fleet, error)

func (*Harness) GetFleetByYaml added in v0.4.0

func (h *Harness) GetFleetByYaml(fleetYaml string) v1beta1.Fleet

Wrapper function for Fleet

func (*Harness) GetFleetVulnerabilities added in v1.2.0

func (h *Harness) GetFleetVulnerabilities(v1alpha1Client *v1alpha1client.ClientWithResponses, fleetName string, params *v1alpha1.GetFleetVulnerabilitiesParams) (*v1alpha1.VulnerabilityGroupList, error)

GetFleetVulnerabilities retrieves vulnerabilities for a specific fleet.

func (*Harness) GetFleetVulnerabilitySummary added in v1.2.0

func (h *Harness) GetFleetVulnerabilitySummary(v1alpha1Client *v1alpha1client.ClientWithResponses, fleetName string) (*v1alpha1.FleetVulnerabilitySummaryResponse, error)

GetFleetVulnerabilitySummary retrieves the vulnerability summary for a fleet.

func (*Harness) GetFlightctlAgentJournal added in v1.2.0

func (h *Harness) GetFlightctlAgentJournal(tailLines int) (string, error)

GetFlightctlAgentJournal returns flightctl-agent journal text from the primary VM. tailLines selects journalctl -n tailLines; when <= 0, defaultAgentJournalTailLines is used.

func (*Harness) GetFlightctlAgentLogs added in v0.10.0

func (h *Harness) GetFlightctlAgentLogs() (string, error)

GetFlightctlAgentLogs returns the logs from the flightctl-agent service using journalctl.

func (*Harness) GetFlightctlBackupPath added in v1.2.0

func (h *Harness) GetFlightctlBackupPath() string

GetFlightctlBackupPath returns the path to the flightctl-backup binary (same directory as the CLI).

func (*Harness) GetFlightctlPath added in v0.10.0

func (h *Harness) GetFlightctlPath() string

GetFlightctlPath returns the path to the flightctl binary

func (*Harness) GetFlightctlRestorePath added in v1.2.0

func (h *Harness) GetFlightctlRestorePath() string

GetFlightctlRestorePath returns the path to the flightctl-restore binary (same directory as the CLI).

func (*Harness) GetFreeLocalPort added in v1.1.0

func (h *Harness) GetFreeLocalPort() (int, error)

GetFreeLocalPort returns an available local TCP port.

func (*Harness) GetGitRepoURL added in v0.10.0

func (h *Harness) GetGitRepoURL(repoName string) (string, error)

GetGitRepoURL returns the SSH URL for a git repository on the server

func (*Harness) GetImageBuild added in v1.1.0

func (h *Harness) GetImageBuild(name string) (*imagebuilderapi.ImageBuild, error)

GetImageBuild retrieves an ImageBuild resource by name.

func (*Harness) GetImageBuildConditionReason added in v1.1.0

func (h *Harness) GetImageBuildConditionReason(name string) (string, error)

GetImageBuildConditionReason returns the current condition reason for an ImageBuild.

func (*Harness) GetImageBuildConditionReasonAndMessage added in v1.1.0

func (h *Harness) GetImageBuildConditionReasonAndMessage(name string) (reason, message string, err error)

GetImageBuildConditionReasonAndMessage returns both the reason and message for an ImageBuild condition.

func (*Harness) GetImageBuildLogs added in v1.1.0

func (h *Harness) GetImageBuildLogs(name string) (string, error)

GetImageBuildLogs retrieves the logs for an ImageBuild.

func (*Harness) GetImageExport added in v1.1.0

func (h *Harness) GetImageExport(name string) (*imagebuilderapi.ImageExport, error)

GetImageExport retrieves an ImageExport resource by name.

func (*Harness) GetImageExportConditionReason added in v1.1.0

func (h *Harness) GetImageExportConditionReason(name string) (string, error)

GetImageExportConditionReason returns the current condition reason for an ImageExport.

func (*Harness) GetImageExportLogs added in v1.1.0

func (h *Harness) GetImageExportLogs(name string) (string, error)

GetImageExportLogs retrieves the logs for an ImageExport.

func (*Harness) GetInternalGitRepoURL added in v1.1.0

func (h *Harness) GetInternalGitRepoURL(internalHost string, internalPort int, repoName string) (string, error)

GetInternalGitRepoURL returns the internal cluster URL for a git repository on the E2E git server. Callers pass internalHost and internalPort from infra (e.g. auxiliary.Services).

func (*Harness) GetOrganizationID added in v1.1.0

func (h *Harness) GetOrganizationID() (string, error)

GetOrganizationID returns the first organization ID from the API.

func (*Harness) GetOrganizationIDByDisplayName added in v1.2.0

func (h *Harness) GetOrganizationIDByDisplayName(displayName string) (string, error)

GetOrganizationIDByDisplayName returns the organization ID (UUID) whose Spec.DisplayName matches the given display name.

func (*Harness) GetOrganizationIDForNamespace added in v1.1.0

func (h *Harness) GetOrganizationIDForNamespace(namespace string) (string, error)

GetOrganizationIDForNamespace returns the organization ID whose Spec.ExternalId matches the given namespace (e.g. OpenShift project). If none match, returns an error so callers can fall back to GetOrganizationID() if desired.

func (*Harness) GetPodsInNamespace added in v1.2.0

func (h *Harness) GetPodsInNamespace(namespace string) ([]string, error)

GetPodsInNamespace returns a list of pod names in the specified namespace.

func (*Harness) GetRepository added in v0.10.0

func (h *Harness) GetRepository(repositoryName string) (*v1beta1.Repository, error)

func (*Harness) GetRepositoryByYaml added in v0.4.0

func (h *Harness) GetRepositoryByYaml(repoYaml string) v1beta1.Repository

Wrapper function for Repository

func (*Harness) GetResourceSync added in v1.1.0

func (h *Harness) GetResourceSync(name string) (*v1beta1.ResourceSync, error)

func (*Harness) GetResourceSyncByYaml added in v0.4.0

func (h *Harness) GetResourceSyncByYaml(rSyncYaml string) v1beta1.ResourceSync

Wrapper function for ResourceSync

func (*Harness) GetResourceSyncConditionMessage added in v1.1.0

func (h *Harness) GetResourceSyncConditionMessage(name string, condType v1beta1.ConditionType) (string, error)

func (*Harness) GetResourcesByName added in v0.8.1

func (h *Harness) GetResourcesByName(resourceType string, resourceName ...string) (string, error)

Wrapper function for Shell command to get resources by name

func (*Harness) GetRolloutStatus added in v0.8.1

func (h *Harness) GetRolloutStatus(fleetName string) (v1beta1.Condition, error)

func (*Harness) GetSelectedDevicesForBatch added in v0.8.1

func (h *Harness) GetSelectedDevicesForBatch(fleetName string) ([]*v1beta1.Device, error)

func (*Harness) GetServiceLogs added in v0.10.0

func (h *Harness) GetServiceLogs(serviceName string) (string, error)

GetServiceLogs returns the logs from the specified service using journalctl. This is useful for debugging service output and capturing logs from the latest service invocation.

func (*Harness) GetSleepAppImageRefForFleet added in v1.2.0

func (h *Harness) GetSleepAppImageRefForFleet(registryHost, registryPort, tag string) string

GetSleepAppImageRefForFleet returns the sleep-app image reference for use in device specs. Pass registryHost and registryPort from auxiliary (e.g. auxiliary.Get(ctx).Registry.Host, .Registry.Port); if either is empty, returns the quay.io fallback.

func (*Harness) GetTestContext added in v0.10.0

func (h *Harness) GetTestContext() context.Context

GetTestContext returns the current test context. If no test context has been set, it returns the suite context.

func (*Harness) GetTestDataFromContext added in v0.10.0

func (h *Harness) GetTestDataFromContext(key string) (interface{}, bool)

GetTestDataFromContext retrieves arbitrary test data from the context using a string key

func (*Harness) GetTestIDFromContext added in v0.10.0

func (h *Harness) GetTestIDFromContext() string

GetTestIDFromContext retrieves the test ID from the context If no test ID is found, it indicates a programming error and will cause the test to fail

func (*Harness) GetUnavailableDevicesPerGroup added in v0.8.1

func (h *Harness) GetUnavailableDevicesPerGroup(fleetName string, groupBy []string) (map[string][]*v1beta1.Device, error)

func (*Harness) GetUpdatedDevices added in v0.8.1

func (h *Harness) GetUpdatedDevices(fleetName string) ([]*v1beta1.Device, error)

func (*Harness) GetUserHomeOnVM added in v1.2.0

func (h *Harness) GetUserHomeOnVM(user string) (string, error)

GetUserHomeOnVM returns the home directory of the given user on the VM.

func (*Harness) GetV1Alpha1Client added in v1.2.0

func (h *Harness) GetV1Alpha1Client() *v1alpha1client.ClientWithResponses

GetV1Alpha1Client returns the v1alpha1 API client for alpha resources like vulnerabilities. Returns nil if the client wrapper is not available.

func (*Harness) GetVMFromPool added in v0.10.0

func (h *Harness) GetVMFromPool(workerID int) (vm.TestVMInterface, error)

GetVMFromPool retrieves a VM from the pool for the given worker ID. VMs are created on-demand if they don't already exist in the pool.

func (*Harness) GetVersionsFromCLI added in v0.10.0

func (h *Harness) GetVersionsFromCLI() (clientVersion, serverVersion, agentVersion string, err error)

GetVersionsFromCLI returns client, server, and agent versions from the flightctl CLI version command

func (*Harness) GetVulnerabilityImpact added in v1.2.0

func (h *Harness) GetVulnerabilityImpact(v1alpha1Client *v1alpha1client.ClientWithResponses, cveID string, params *v1alpha1.GetVulnerabilityImpactParams) (*v1alpha1.VulnerabilityImpact, error)

GetVulnerabilityImpact retrieves the impact analysis for a specific CVE.

func (*Harness) GetVulnerabilityList added in v1.2.0

GetVulnerabilityList retrieves the organization-level vulnerability list.

func (*Harness) GetYAML added in v1.0.0

func (h *Harness) GetYAML(name string) (string, error)

GetYAML returns the YAML output of a given resource name via Harness.CLI. No test framework calls inside; returns (string, error).

func (*Harness) HTTPGet added in v1.1.0

func (h *Harness) HTTPGet(client *http.Client, baseURL, path, bearerToken string) (int, string, error)

HTTPGet performs a GET request against baseURL+path with optional bearer token.

func (*Harness) HTTPGetWithContentType added in v1.1.0

func (h *Harness) HTTPGetWithContentType(client *http.Client, baseURL, path, bearerToken string) (int, string, string, error)

HTTPGetWithContentType performs a GET request against baseURL+path with optional bearer token.

func (*Harness) HeadlessEditorWrapper added in v1.0.0

func (h *Harness) HeadlessEditorWrapper(marker string) (string, error)

func (*Harness) ImageBuildExists added in v1.1.0

func (h *Harness) ImageBuildExists(name string) bool

ImageBuildExists checks if an ImageBuild resource exists.

func (*Harness) ImageExportExists added in v1.1.0

func (h *Harness) ImageExportExists(name string) bool

ImageExportExists checks if an ImageExport resource exists.

func (*Harness) IsAgentServiceRunning added in v1.2.0

func (h *Harness) IsAgentServiceRunning() bool

func (*Harness) IsRepositoryAccessible added in v1.1.0

func (h *Harness) IsRepositoryAccessible(name string) (bool, error)

IsRepositoryAccessible checks if a repository has its Accessible condition set to True.

func (*Harness) JSONStatusCodePoller added in v1.1.0

func (h *Harness) JSONStatusCodePoller(client *http.Client, baseURL, path, bearerToken, contentTypeMustContain string, expectedStatus int) func() int

JSONStatusCodePoller returns a poller that validates status code and JSON body/content type.

func (*Harness) JournalSinceFromPrimaryVM added in v1.2.0

func (h *Harness) JournalSinceFromPrimaryVM() (string, error)

JournalSinceFromPrimaryVM returns RFC3339 UTC suitable for journalctl --since on the guest, aligned to the VM clock. The value is rewound slightly so same-second log lines are not dropped at the boundary. Use immediately before an action whose logs you will scan with WaitForAgentJournalUntil or ReadPrimaryVMAgentLogs(since, ...).

func (*Harness) ListImageBuilds added in v1.1.0

ListImageBuilds lists all ImageBuild resources.

func (*Harness) ListImageExports added in v1.1.0

ListImageExports lists all ImageExport resources.

func (*Harness) ListRepositories added in v1.1.0

func (h *Harness) ListRepositories() (*v1beta1.RepositoryList, error)

ListRepositories lists all repositories.

func (*Harness) ManageResource added in v0.7.0

func (h *Harness) ManageResource(operation, resource string, args ...string) (string, error)

ManageResource performs an operation ("apply", "delete", "approve" or "deny") on a specified resource.

func (*Harness) MarkClientAccessTokenExpired added in v0.8.1

func (h *Harness) MarkClientAccessTokenExpired(filePath string) error

MarkClientAccessTokenExpired updates the client configuration at the specified path by marking the token as expired If no path is supplied, the default config path will be used

func (*Harness) MetricsBody added in v1.1.0

func (h *Harness) MetricsBody(url string) func() string

MetricsBody returns a closure to fetch metrics for Eventually.

func (*Harness) MetricsLineCount added in v1.1.0

func (h *Harness) MetricsLineCount(url string) func() int

MetricsLineCount returns a closure to count lines in a metrics payload.

func (*Harness) MetricsMatchLabels added in v1.1.0

func (h *Harness) MetricsMatchLabels(url string, exact map[string]string, required, requiredNonEmpty []string) func() bool

MetricsMatchLabels returns a closure to check for a metric with required labels.

func (*Harness) NewBackupRestore added in v1.2.0

func (h *Harness) NewBackupRestore(p *infra.Providers) *BackupRestore

NewBackupRestore returns a BackupRestore that uses this harness and the given providers. If p is nil, setup.GetDefaultProviders() is used.

func (*Harness) NewConsoleSession added in v0.9.0

func (h *Harness) NewConsoleSession(deviceID string) *ConsoleSession

NewConsoleSession starts a PTY console session to the specified device.

func (*Harness) OTelcolActiveStatus added in v1.1.0

func (h *Harness) OTelcolActiveStatus() func() string

OTelcolActiveStatus returns a closure for Eventually to check otelcol status.

func (*Harness) PathDoesNotExistOnDevice added in v1.2.0

func (h *Harness) PathDoesNotExistOnDevice(path string) error

PathDoesNotExistOnDevice checks that the given path does not exist on the device.

func (*Harness) PathExistsOnDevice added in v1.2.0

func (h *Harness) PathExistsOnDevice(path string) error

PathExistsOnDevice checks that the given path exists on the device.

func (*Harness) PrepareNextDeviceGeneration added in v0.6.0

func (h *Harness) PrepareNextDeviceGeneration(deviceId string) (int64, error)

func (*Harness) PrepareNextDeviceVersion added in v0.4.0

func (h *Harness) PrepareNextDeviceVersion(deviceId string) (int, error)

func (*Harness) PrepareNextDeviceVersionFromCurrentStatus added in v1.2.0

func (h *Harness) PrepareNextDeviceVersionFromCurrentStatus(deviceID string) (int, error)

PrepareNextDeviceVersionFromCurrentStatus polls until Status.Config.RenderedVersion becomes valid (> 0) and returns RenderedVersion+1. Unlike PrepareNextDeviceVersion it does not require the device to be UpToDate, so it is safe to call after greenboot rollback when the device is OutOfDate and may still be re-enrolling.

func (*Harness) PrintAgentLogsIfFailed added in v1.1.0

func (h *Harness) PrintAgentLogsIfFailed()

PrintAgentLogsIfFailed prints flightctl-agent journalctl logs from all boots if the current test failed. This is useful for VM pool-based tests where Cleanup is not called and logs need to be captured on failure.

func (*Harness) PromQuery added in v1.1.0

func (h *Harness) PromQuery(baseURL, query string) (PromQueryResponse, error)

PromQuery executes a Prometheus query against a base URL.

func (*Harness) PromQueryCountValue added in v1.1.0

func (h *Harness) PromQueryCountValue(promURL, query string) func() float64

PromQueryCountValue returns a closure for polling a count() query value.

func (*Harness) PromQueryHasLabels added in v1.1.0

func (h *Harness) PromQueryHasLabels(promURL, query string, exact map[string]string, required []string) func() bool

PromQueryHasLabels returns a closure to check for a query result with required labels.

func (*Harness) PromQueryResultCount added in v1.1.0

func (h *Harness) PromQueryResultCount(promURL, query string) func() int

PromQueryResultCount returns a closure for polling the count of query results.

func (*Harness) PromQueryWithClientToken added in v1.2.0

func (h *Harness) PromQueryWithClientToken(client *http.Client, baseURL, query, bearerToken string) (PromQueryResponse, error)

PromQueryWithClientToken executes a Prometheus query against a base URL with optional bearer token, using the provided HTTP client.

func (*Harness) PromQueryWithToken added in v1.1.0

func (h *Harness) PromQueryWithToken(baseURL, query, bearerToken string) (PromQueryResponse, error)

PromQueryWithToken executes a Prometheus query against a base URL with optional bearer token.

func (*Harness) PushContentToGitServerRepo added in v0.10.0

func (h *Harness) PushContentToGitServerRepo(config GitServerConfig, keyPath util.SSHPrivateKeyPath, repoName, filePath, content, commitMessage string) error

PushContentToGitServerRepo pushes content to a git repository on the server.

func (*Harness) PushContentToGitServerRepoFromPath added in v1.1.0

func (h *Harness) PushContentToGitServerRepoFromPath(config GitServerConfig, keyPath util.SSHPrivateKeyPath, repoName, sourcePath, commitMessage string) error

PushContentToGitServerRepoFromPath reads content from a local file or directory and pushes it to a git repository on the server.

func (*Harness) PushTemplatedFilesToGitRepo added in v1.1.0

func (h *Harness) PushTemplatedFilesToGitRepo(workDir string, keyPath util.SSHPrivateKeyPath, sourceDir string, data interface{}) error

PushTemplatedFilesToGitRepo updates an existing git repo with templated files, commits and pushes.

func (*Harness) QuadletImageAppSpec added in v1.1.0

func (h *Harness) QuadletImageAppSpec(name, image string, envVars map[string]string) (v1beta1.ApplicationProviderSpec, error)

QuadletImageAppSpec builds an ApplicationProviderSpec for a quadlet app from an image and env vars.

func (*Harness) QuadletPathForUserOnVM added in v1.2.0

func (h *Harness) QuadletPathForUserOnVM(user string) (string, error)

QuadletPathForUserOnVM returns the quadlet systemd path for the given user using the user's actual home on the VM (from getent).

func (*Harness) RbacDeniedCancelCreateDelete added in v1.2.0

func (h *Harness) RbacDeniedCancelCreateDelete(
	roleLabel, forbiddenNamePrefix, testID string,
	imageBuildName, imageExportName string,
	imageBuildSpec imagebuilderapi.ImageBuildSpec,
	exportSpec imagebuilderapi.ImageExportSpec,
	download RbacDownloadExpectation,
) error

RbacDeniedCancelCreateDelete exercises forbidden mutations and optional download expectation for a non-admin role.

func (*Harness) RbacDeniedImageBuildExportLogs added in v1.2.0

func (h *Harness) RbacDeniedImageBuildExportLogs(imageBuildName, imageExportName, roleLabel string) error

RbacDeniedImageBuildExportLogs asserts GET imagebuilds/{name}/log and imageexports/{name}/log return HTTP 403.

func (*Harness) ReadClientConfig added in v0.8.1

func (h *Harness) ReadClientConfig(filePath string) (*client.Config, error)

ReadClientConfig returns the client config for at the specified location. The default config path is used if no path is specified

func (*Harness) ReadFileFromDevice added in v1.2.0

func (h *Harness) ReadFileFromDevice(filePath string) (string, error)

ReadFileFromDevice reads a file from the device via SSH and returns its content.

func (*Harness) ReadImageBuildExportAccess added in v1.2.0

func (h *Harness) ReadImageBuildExportAccess(imageBuildName, imageExportName string, opts RbacReadOpts) error

ReadImageBuildExportAccess performs get/list/read logs; returns an error if any step fails expectations.

func (*Harness) ReadPrimaryVMAgentLogs added in v0.9.0

func (h *Harness) ReadPrimaryVMAgentLogs(since string, unit string) (string, error)

ReadPrimaryVMAgentLogs reads journalctl logs from the primary VM for the given unit. Output is capped: without a since time, only the last defaultAgentJournalTailLines entries are returned; with a non-empty since (RFC3339 or journalctl time string), up to agentJournalLinesSinceTimeCap entries after since.

func (*Harness) RebootVMAndWaitForSSH added in v1.1.0

func (h *Harness) RebootVMAndWaitForSSH(waitInterval time.Duration, maxAttempts int) error

RebootVMAndWaitForSSH triggers a reboot on the VM and waits for SSH to become ready again.

func (*Harness) RefreshClient added in v1.1.0

func (h *Harness) RefreshClient() error

RefreshClient recreates the FlightCtl API client and ImageBuilder client from the config file. This is useful after login when the config file has been updated with new authentication or organization information.

func (*Harness) RefreshCluster added in v1.2.0

func (h *Harness) RefreshCluster() error

RefreshCluster refreshes the Kubernetes client by re-reading the kubeconfig. This is useful after switching kubectl contexts or logging in as a different user.

func (*Harness) ReloadFlightCtlAgent added in v0.10.0

func (h *Harness) ReloadFlightCtlAgent() error

ReloadFlightCtlAgent reloads the flightctl-agent service

func (*Harness) RemoveAgentFile added in v1.2.0

func (h *Harness) RemoveAgentFile(path string) error

RemoveAgentFile removes a file on the VM using sudo rm -f.

func (*Harness) ReplaceRepository added in v0.9.0

func (h *Harness) ReplaceRepository(repositorySpec v1beta1.RepositorySpec, metadata v1beta1.ObjectMeta) error

ReplaceRepository ensures the specified repository exists and is updated to the appropriate values

func (*Harness) ReplaceResourceSync added in v0.10.0

func (h *Harness) ReplaceResourceSync(name, repoName string, spec v1beta1.ResourceSyncSpec) error

ReplaceResourceSync replaces an existing ResourceSync resource

func (*Harness) ReplaceVariableInString added in v0.4.0

func (h *Harness) ReplaceVariableInString(s string, old string, new string) string

func (*Harness) ResetAgent added in v0.9.0

func (h *Harness) ResetAgent() error

reset agent

func (*Harness) ResetAgentEnrollmentState added in v1.2.0

func (h *Harness) ResetAgentEnrollmentState() error

ResetAgentEnrollmentState stops the agent and removes local enrollment identity state.

func (*Harness) ResolveImage added in v1.1.0

func (h *Harness) ResolveImage(registry, imageName, tag string) (ocispec.Descriptor, error)

ResolveImage resolves an image reference in an OCI registry and returns its descriptor. registry: the registry host (e.g., "localhost:5000") imageName: the image name (e.g., "myimage" or "namespace/myimage") tag: the image tag (e.g., "latest" or "v1.0")

func (*Harness) ResolveOrganizationAndClientToken added in v1.1.0

func (h *Harness) ResolveOrganizationAndClientToken() (string, string, error)

func (*Harness) RestartFlightCtlAgent added in v0.10.0

func (h *Harness) RestartFlightCtlAgent() error

RestartFlightCtlAgent restarts the flightctl-agent service

func (*Harness) RunConsoleCommand added in v0.9.0

func (h *Harness) RunConsoleCommand(deviceID string, flags []string, cmd ...string) (string, error)

RunConsoleCommand executes the flightctl console command for the given device.

flags – optional CLI flags that go before "--" (e.g. "--notty").
cmd   – remote command (and its args) to execute after "--". Must contain
        at least one string; for interactive sessions use NewConsoleSession.

func (*Harness) RunDeviceSimulator added in v1.1.0

func (h *Harness) RunDeviceSimulator(_ context.Context, args ...string) (*exec.Cmd, error)

RunDeviceSimulator starts the devicesimulator in the background with the provided args and returns the running command. The process will continue running until explicitly stopped via StopDeviceSimulator. IMPORTANT: The caller MUST call StopDeviceSimulator to clean up the process and close the log file. The context parameter is reserved for future use (e.g., cancellation during setup).

func (*Harness) RunGetDevices added in v0.7.0

func (h *Harness) RunGetDevices(args ...string) (string, error)

RunGetDevices executes "get devices" CLI command with optional arguments.

func (*Harness) RunGetEvents added in v0.8.1

func (h *Harness) RunGetEvents(args ...string) (string, error)

RunGetEvents executes "get events" CLI command with optional arguments.

func (*Harness) RunInteractiveCLI

func (h *Harness) RunInteractiveCLI(args ...string) (io.WriteCloser, io.ReadCloser, error)

func (*Harness) RunPodmanPsContainerNames added in v1.1.0

func (h *Harness) RunPodmanPsContainerNames(allContainers bool) (string, error)

RunPodmanPsContainerNames runs podman ps (or podman ps -a) on the VM as root and returns container names.

func (*Harness) RunPodmanPsContainerNamesAsUser added in v1.2.0

func (h *Harness) RunPodmanPsContainerNamesAsUser(user string, allContainers bool) (string, error)

RunPodmanPsContainerNamesAsUser runs podman ps (or podman ps -a) on the VM as the given user and returns container names.

func (*Harness) RunScriptOnVM added in v1.2.0

func (h *Harness) RunScriptOnVM(script string) (*bytes.Buffer, error)

RunScriptOnVM executes a bash script on the VM without relying on direct shell quoting of the full script body.

func (*Harness) RunSystemctlUserStatus added in v1.2.0

func (h *Harness) RunSystemctlUserStatus(user, unitPattern string) (string, error)

RunSystemctlUserStatus runs systemctl --user status for the given user on the VM.

func (*Harness) RunVMCommandWithEvidence added in v1.1.0

func (h *Harness) RunVMCommandWithEvidence(artifactDir, filename, command string) (string, error)

RunVMCommandWithEvidence runs a VM command and captures its output.

func (*Harness) SH added in v0.3.0

func (h *Harness) SH(command string, args ...string) (string, error)

func (*Harness) SHWithStdin added in v0.3.0

func (h *Harness) SHWithStdin(stdin, command string, args ...string) (string, error)

func (*Harness) SetAgentConfig added in v0.10.0

func (h *Harness) SetAgentConfig(cfg *agentcfg.Config) error

SetAgentConfig configures the agent by writing the configuration file. This method should be called before starting the agent.

func (*Harness) SetCurrentOrganization added in v1.1.0

func (h *Harness) SetCurrentOrganization(organization string) error

SetCurrentOrganization sets the organization in the client config file and refreshes the harness client. Call after changing namespace/login so subsequent API calls use this org.

func (*Harness) SetDeviceApplications added in v1.1.0

func (h *Harness) SetDeviceApplications(deviceID string, apps *[]v1beta1.ApplicationProviderSpec) error

SetDeviceApplications sets device.Spec.Applications and waits for the new rendered version.

func (*Harness) SetLabelsForDevice added in v0.9.0

func (h *Harness) SetLabelsForDevice(deviceId string, labels map[string]string) error

func (*Harness) SetLabelsForDeviceMetadata added in v0.10.0

func (h *Harness) SetLabelsForDeviceMetadata(metadata *v1beta1.ObjectMeta, labels map[string]string)

SetLabelsForDeviceMetadata sets labels on device metadata while preserving the test-id label

func (*Harness) SetLabelsForDevicesByIndex added in v0.8.1

func (h *Harness) SetLabelsForDevicesByIndex(deviceIDs []string, labelsList []map[string]string, fleetName string) error

func (*Harness) SetLabelsForFleetMetadata added in v0.10.0

func (h *Harness) SetLabelsForFleetMetadata(metadata *v1beta1.ObjectMeta, labels map[string]string)

SetLabelsForFleetMetadata sets labels on fleet metadata while preserving the test-id label

func (*Harness) SetLabelsForRepositoryMetadata added in v0.10.0

func (h *Harness) SetLabelsForRepositoryMetadata(metadata *v1beta1.ObjectMeta, labels map[string]string)

SetLabelsForRepositoryMetadata sets labels on repository metadata while preserving the test-id label

func (*Harness) SetLabelsForResource added in v0.10.0

func (h *Harness) SetLabelsForResource(metadata *v1beta1.ObjectMeta, labels map[string]string)

SetLabelsForResource sets labels on any resource while preserving the test-id label

func (*Harness) SetTestContext added in v0.10.0

func (h *Harness) SetTestContext(ctx context.Context)

SetTestContext sets the context for the current test. This allows tests to use their own context for operations while keeping the suite context for cleanup operations.

func (*Harness) SetupDeviceSimulatorAgentConfig added in v1.1.0

func (h *Harness) SetupDeviceSimulatorAgentConfig(specFetch time.Duration, statusUpdate time.Duration) (string, error)

SetupDeviceSimulatorAgentConfig generates an agent configuration file for the device simulator and copies required certificates into the expected locations under ~/.flightctl. Non-zero durations override fetch/update intervals; zero values default to 2 seconds. Returns the path to the generated agent config file.

func (*Harness) SetupScenario added in v1.1.0

func (h *Harness) SetupScenario(deviceID, testCase string) (string, error)

SetupScenario creates the artifacts dir for the scenario.

func (*Harness) SetupTemplatedGitRepoFromDir added in v1.1.0

func (h *Harness) SetupTemplatedGitRepoFromDir(config GitServerConfig, keyPath util.SSHPrivateKeyPath, repoName, sourceDir string, data interface{}) (string, error)

SetupTemplatedGitRepoFromDir creates a git repo, clones it, populates with templated files, and pushes.

func (*Harness) SetupVMFromPool added in v1.1.0

func (h *Harness) SetupVMFromPool(workerID int) error

SetupVMFromPool sets up a VM from the pool and reverts it to the pristine snapshot. It does not start the agent. The operation is bounded by setupSnapshotRestoreTimeout (10 minutes).

func (*Harness) SetupVMFromPoolAndStartAgent added in v0.10.0

func (h *Harness) SetupVMFromPoolAndStartAgent(workerID int) error

SetupVMFromPoolAndStartAgent sets up a VM from the pool, reverts to pristine snapshot, and starts the agent. This is useful for tests that use the VM pool pattern.

func (*Harness) SetupVMFromPoolWithTPM added in v1.2.0

func (h *Harness) SetupVMFromPoolWithTPM(workerID int, detected TPMType) error

SetupVMFromPoolWithTPM sets up a VM from the pool, configures TPM, and starts the agent. AuthEnabled is set based on TPM type: true for swtpm, false for real hardware to avoid taking ownership of real TPM devices.

func (*Harness) SetupVMWithTPMPassthrough added in v1.2.0

func (h *Harness) SetupVMWithTPMPassthrough(workerID int, device string) error

SetupVMWithTPMPassthrough creates a fresh VM with TPM passthrough and starts the agent. The VM passes through the specified host TPM device instead of using swtpm. It reuses the fresh VM pool infrastructure for disk overlay creation, SSH setup, and agent state cleanup, then applies TPM-specific agent configuration before starting.

func (*Harness) SimulateNetworkFailure added in v0.8.1

func (h *Harness) SimulateNetworkFailure(registryHost, registryPort string) error

SimulateNetworkFailure blocks VM traffic to the given registry host:port via iptables. Caller must pass the registry host and port (e.g. from infra provider or env).

func (*Harness) SimulateNetworkFailureForCLI added in v0.8.1

func (h *Harness) SimulateNetworkFailureForCLI(ip, port string) (func() error, error)

SimulateNetworkFailureForCLI adds an entry to iptables to drop tcp traffic to the specified port:ip It returns a function that will only execute once to undo the iptables modification

func (*Harness) StartFirstAvailableBackendAccess added in v1.1.0

func (h *Harness) StartFirstAvailableBackendAccess(backends []ServiceAccessBackend, timeout time.Duration) (string, *http.Client, string, func(), ServiceAccessBackend, error)

StartFirstAvailableBackendAccess starts access to the first available backend from a candidate list. If a backend requires auth, a cluster token is returned.

func (*Harness) StartFirstAvailableBackendAccessWithQuery added in v1.2.0

func (h *Harness) StartFirstAvailableBackendAccessWithQuery(backends []ServiceAccessBackend, query string, timeout time.Duration) (string, *http.Client, string, func(), ServiceAccessBackend, error)

StartFirstAvailableBackendAccessWithQuery starts access to the first available backend from a candidate list. Backend readiness is validated by running the provided Prometheus query.

func (*Harness) StartFlightCtlAgent added in v0.10.0

func (h *Harness) StartFlightCtlAgent() error

StartFlightCtlAgent starts or restarts the flightctl-agent service so config changes are picked up.

func (*Harness) StartLabeledSimulator added in v1.2.0

func (h *Harness) StartLabeledSimulator(ctx context.Context, testID, userPrefix string, initialIndex, deviceCount int) (*exec.Cmd, error)

StartLabeledSimulator starts a device simulator with the given test-id label, user prefix, initial device index, and device count. Returns the running command.

func (*Harness) StartServiceAccess added in v1.1.0

func (h *Harness) StartServiceAccess(serviceName string, namespaces []string, remotePort int, useTLS bool, timeout time.Duration) (string, *http.Client, func(), error)

StartServiceAccess exposes a service and returns URL/client/cleanup. For known flightctl services it uses infra ExposeService; for non-mapped services it falls back to kubectl port-forward across provided namespaces.

func (*Harness) StartVMAndEnroll

func (h *Harness) StartVMAndEnroll() string

func (*Harness) StatusCodePollerWithExpectedBody added in v1.1.0

func (h *Harness) StatusCodePollerWithExpectedBody(client *http.Client, baseURL, path, bearerToken, expectedBody string, expectedStatus int) func() int

StatusCodePollerWithExpectedBody returns a poller that validates status code and exact body.

func (*Harness) StopAllSimulators added in v1.2.0

func (h *Harness) StopAllSimulators(cmds []*exec.Cmd, timeout time.Duration)

StopAllSimulators stops all running simulator commands, logging warnings on failure.

func (*Harness) StopDeviceSimulator added in v1.1.0

func (h *Harness) StopDeviceSimulator(cmd *exec.Cmd, timeout time.Duration) error

StopDeviceSimulator attempts to gracefully stop a running devicesimulator process. It sends SIGTERM to the process group and waits up to the provided timeout before force-killing.

func (*Harness) StopFlightCtlAgent added in v0.10.0

func (h *Harness) StopFlightCtlAgent() error

StopFlightCtlAgent stops the flightctl-agent service

func (*Harness) StoreDeviceInTestContext added in v0.10.0

func (h *Harness) StoreDeviceInTestContext(deviceId string, device *v1beta1.Device)

StoreDeviceInTestContext stores device data in the test context for use within the same test

func (*Harness) StoreTestDataInContext added in v0.10.0

func (h *Harness) StoreTestDataInContext(key string, value interface{})

StoreTestDataInContext stores arbitrary test data in the context using a string key

func (*Harness) StreamImageBuildLogsWithTimeout added in v1.1.0

func (h *Harness) StreamImageBuildLogsWithTimeout(name string, streamDuration time.Duration) (string, error)

StreamImageBuildLogsWithTimeout streams logs for an ImageBuild with follow mode for a limited time. Returns the logs captured during the streaming period.

func (*Harness) StreamImageExportLogsWithTimeout added in v1.1.0

func (h *Harness) StreamImageExportLogsWithTimeout(name string, streamDuration time.Duration) (string, error)

StreamImageExportLogsWithTimeout streams logs for an ImageExport with follow mode for a limited time. Returns the logs captured during the streaming period.

func (*Harness) SyncVMClock added in v1.2.0

func (h *Harness) SyncVMClock() error

func (*Harness) TestEnrollmentApproval added in v0.10.0

func (h *Harness) TestEnrollmentApproval(labels ...map[string]string) *v1beta1.EnrollmentRequestApproval

func (*Harness) TestResourceLabels added in v1.2.0

func (h *Harness) TestResourceLabels() (map[string]string, error)

TestResourceLabels returns the test-id label used by e2e cleanup.

func (*Harness) UnblockTrafficOnVM added in v1.2.0

func (h *Harness) UnblockTrafficOnVM(ip, port string)

UnblockTrafficOnVM removes the iptables/ip6tables rule on the VM that blocks TCP traffic to the specified IP and port. Silently ignores errors.

func (*Harness) UpdateAgentConfigWith added in v1.2.0

func (h *Harness) UpdateAgentConfigWith(mutate func(*agentcfg.Config)) error

UpdateAgentConfigWith reads the current agent config from the VM, calls mutate to modify it, writes it back via SetAgentConfig, and restarts the agent.

func (*Harness) UpdateApplication added in v0.8.0

func (h *Harness) UpdateApplication(withRetries bool, deviceId string, appName string, appProvider any, envVars map[string]string) error

func (*Harness) UpdateDevice added in v0.6.0

func (h *Harness) UpdateDevice(deviceId string, updateFunction func(*v1beta1.Device)) error

func (*Harness) UpdateDeviceAndWait added in v1.1.0

func (h *Harness) UpdateDeviceAndWait(deviceID string, updateFunc func(device *v1beta1.Device)) error

func (*Harness) UpdateDeviceAndWaitForFailure added in v1.2.0

func (h *Harness) UpdateDeviceAndWaitForFailure(deviceID string, updateFunc func(device *v1beta1.Device), expectedMessageSubstrings ...string) error

UpdateDeviceAndWaitForFailure updates a device and waits for the update to fail with an error. If expectedMessageSubstrings are provided, it verifies that the error message contains at least one of them (or that the update rolled back, which may not retain the same message text on the status).

func (*Harness) UpdateDeviceAndWaitForVersion added in v1.1.0

func (h *Harness) UpdateDeviceAndWaitForVersion(deviceID string, updateFunc func(device *v1beta1.Device)) error

UpdateDeviceAndWaitForVersion updates the device and waits for the new rendered version

func (*Harness) UpdateDeviceConfigWithRetries added in v0.8.1

func (h *Harness) UpdateDeviceConfigWithRetries(deviceId string, configs []v1beta1.ConfigProviderSpec, nextRenderedVersion int) error

UpdateDeviceConfigWithRetries updates the configuration of a device with retries using the provided harness and config specs. It applies the provided configuration and waits for the device to reach the specified rendered version.

func (*Harness) UpdateDeviceDigest added in v1.2.0

func (h *Harness) UpdateDeviceDigest(deviceName, newDigest string) error

UpdateDeviceDigest updates a device's OS image digest. Uses resourceVersion for optimistic locking and retries on conflict.

func (*Harness) UpdateDeviceWithQuadletInline added in v1.1.0

func (h *Harness) UpdateDeviceWithQuadletInline(deviceID, appName string, paths, contents []string) error

UpdateDeviceWithQuadletInline updates the device with an inline quadlet application (no env vars).

func (*Harness) UpdateDeviceWithQuadletInlineAndEnvs added in v1.1.0

func (h *Harness) UpdateDeviceWithQuadletInlineAndEnvs(deviceID, appName string, envVars map[string]string, paths, contents []string) error

UpdateDeviceWithQuadletInlineAndEnvs updates the device with an inline quadlet application and env vars.

func (*Harness) UpdateDeviceWithQuadletInlineAndEnvsAndRunAs added in v1.2.0

func (h *Harness) UpdateDeviceWithQuadletInlineAndEnvsAndRunAs(deviceID, appName, runAs string, envVars map[string]string, paths, contents []string) error

UpdateDeviceWithQuadletInlineAndEnvsAndRunAs updates the device with an inline quadlet application, env vars, and optional runAs user.

func (*Harness) UpdateDeviceWithQuadletInlineAndRunAs added in v1.2.0

func (h *Harness) UpdateDeviceWithQuadletInlineAndRunAs(deviceID, appName, runAs string, paths, contents []string) error

UpdateDeviceWithQuadletInlineAndRunAs updates the device with an inline quadlet application and optional runAs user.

func (*Harness) UpdateDeviceWithRetries added in v0.3.0

func (h *Harness) UpdateDeviceWithRetries(deviceId string, updateFunction func(*v1beta1.Device)) error

func (*Harness) UpdateFleet added in v0.9.0

func (h *Harness) UpdateFleet(fleetName string, updateFunc func(*v1beta1.Fleet)) error

func (*Harness) UpdateFleetWithRetries added in v0.9.0

func (h *Harness) UpdateFleetWithRetries(fleetName string, updateFunction func(*v1beta1.Fleet))

func (*Harness) UpdateGitServerRepository added in v0.10.0

func (h *Harness) UpdateGitServerRepository(config GitServerConfig, keyPath util.SSHPrivateKeyPath, repoName, filePath, content, commitMessage string) error

UpdateGitServerRepository updates content in an existing git repository working directory.

func (*Harness) UpdateOCIRepositoryRegistry added in v1.1.0

func (h *Harness) UpdateOCIRepositoryRegistry(name, newRegistry string, skipTLSVerify bool) error

UpdateOCIRepositoryRegistry updates an OCI repository's registry URL.

func (*Harness) UpdateSystemdMatchPatterns added in v1.0.0

func (h *Harness) UpdateSystemdMatchPatterns(deviceID string, patterns []string) error

UpdateSystemdMatchPatterns applies the given match patterns to device.spec.systemd.

func (*Harness) VMCommandOutputFunc added in v1.1.0

func (h *Harness) VMCommandOutputFunc(command string, trim bool) func() string

VMCommandOutputFunc returns a polling function for Eventually/Consistently.

func (*Harness) VMDaemonReload added in v1.2.0

func (h *Harness) VMDaemonReload() error

func (*Harness) ValidateFleetYAMLDevicesPerFleet added in v1.1.0

func (h *Harness) ValidateFleetYAMLDevicesPerFleet(yamlContent string, expectedDevicesPerFleet int, expectedFleetCount int) error

func (*Harness) ValidateImageSBOM added in v1.2.0

func (h *Harness) ValidateImageSBOM(registry, imageName, imageDigest string) (*SBOMValidationResult, error)

ValidateImageSBOM validates that an SBOM exists for the image and contains the expected digest. registry: the registry host (e.g., "localhost:5000") imageName: the image name (e.g., "myimage" or "namespace/myimage") imageDigest: the expected image digest (e.g., "sha256:...") Returns the validation result with details about the SBOM.

func (*Harness) VerifyCommandLacksSubstring added in v1.1.0

func (h *Harness) VerifyCommandLacksSubstring(args []string, s string) error

func (*Harness) VerifyCommandOutputsSubstring added in v1.1.0

func (h *Harness) VerifyCommandOutputsSubstring(args []string, s string) error

func (*Harness) VerifyContainerCount added in v1.1.0

func (h *Harness) VerifyContainerCount(count int) error

func (*Harness) VerifyContainerRunning added in v1.1.0

func (h *Harness) VerifyContainerRunning(imageSubstring string)

VerifyContainerRunning checks that podman shows containers running with the given image substring

func (*Harness) VerifyDeviceGitConfigPath added in v1.2.0

func (h *Harness) VerifyDeviceGitConfigPath(deviceId, configName, expectedPath string) error

VerifyDeviceGitConfigPath fetches the device and asserts that the named git config's resolved path matches expectedPath.

func (*Harness) VerifyDeviceTPMAttestationData added in v0.10.0

func (h *Harness) VerifyDeviceTPMAttestationData(device *v1beta1.Device) error

VerifyDeviceTPMAttestationData checks for TPM attestation data in device SystemInfo.

func (*Harness) VerifyEnrollmentTPMAttestationData added in v0.10.0

func (h *Harness) VerifyEnrollmentTPMAttestationData(systemInfo v1beta1.DeviceSystemInfo) error

VerifyEnrollmentTPMAttestationData checks for TPM attestation data in enrollment request SystemInfo.

func (*Harness) VerifyQuadletApplicationFolderDeleted added in v1.1.0

func (h *Harness) VerifyQuadletApplicationFolderDeleted(appName string)

VerifyQuadletApplicationFolderDeleted checks that the application folder was removed

func (*Harness) VerifyQuadletApplicationFolderDeletedAt added in v1.2.0

func (h *Harness) VerifyQuadletApplicationFolderDeletedAt(appName, basePath string)

VerifyQuadletApplicationFolderDeletedAt checks that the application folder does not exist at the given base path.

func (*Harness) VerifyQuadletApplicationFolderExists added in v1.1.0

func (h *Harness) VerifyQuadletApplicationFolderExists(appName string)

VerifyQuadletApplicationFolderExists checks that the application folder exists

func (*Harness) VerifyQuadletApplicationFolderExistsAt added in v1.2.0

func (h *Harness) VerifyQuadletApplicationFolderExistsAt(appName, basePath string)

VerifyQuadletApplicationFolderExistsAt checks that the application folder exists at the given base path.

func (*Harness) VerifyQuadletPodmanArgs added in v1.1.0

func (h *Harness) VerifyQuadletPodmanArgs(appName, flag, expectedValue string)

VerifyQuadletPodmanArgs verifies that a quadlet file contains the expected PodmanArgs entry

func (*Harness) WaitForAgentJournalToContain added in v1.2.0

func (h *Harness) WaitForAgentJournalToContain(description, substring, since string, tailLines int, timeout, polling string)

WaitForAgentJournalToContain polls until the flightctl-agent journal text contains substring. since and tailLines behave like WaitForAgentJournalUntil. Prefer WaitForAgentJournalUntil when a single phrase is too brittle across environments.

func (*Harness) WaitForAgentJournalUntil added in v1.2.0

func (h *Harness) WaitForAgentJournalUntil(description string, since string, tailLines int, timeout, polling string, pred func(string) bool)

WaitForAgentJournalUntil polls until pred returns true on flightctl-agent journal output. If since is non-empty (RFC3339 or journalctl time string, typically guest-aligned UTC), journalctl --since is applied so only entries at or after that time are considered; tailLines caps --n (when <= 0, agentJournalLinesSinceTimeCap is used with since). If since is empty, only -n is used; when tailLines <= 0, defaultAgentJournalTailLines applies. timeout and polling are Ginkgo duration strings (see TIMEOUT, POLLING in this package).

func (*Harness) WaitForApplicationReadyCount added in v1.2.0

func (h *Harness) WaitForApplicationReadyCount(deviceId, appName, expectedReady string, expectedSummary v1beta1.ApplicationsSummaryStatusType)

WaitForApplicationReadyCount waits until an application reports the expected ready/total pod count.

func (*Harness) WaitForApplicationRunningStatus added in v1.1.0

func (h *Harness) WaitForApplicationRunningStatus(deviceId string, applicationImage string)

WaitForApplicationRunningStatus waits for a specific application on a device to reach the "Running" status with all expected workloads running within a timeout.

func (*Harness) WaitForApplicationStatus added in v1.1.0

func (h *Harness) WaitForApplicationStatus(deviceID, appName string, status v1beta1.ApplicationStatusType, timeout, polling time.Duration) error

WaitForApplicationStatus polls until the device reports the given application with the given status, or timeout.

func (*Harness) WaitForApplicationStatusByName added in v1.1.0

func (h *Harness) WaitForApplicationStatusByName(deviceId string, applicationName string, expectedStatus v1beta1.ApplicationStatusType)

WaitForApplicationStatusByName waits for an application to reach the specified status. For Running status, it also verifies ready replicas match.

func (*Harness) WaitForApplicationSummary added in v1.2.0

func (h *Harness) WaitForApplicationSummary(deviceID string, timeout, polling time.Duration, expectedStatuses ...v1beta1.ApplicationsSummaryStatusType) error

WaitForApplicationSummary polls until the device's applications summary matches any of the expected statuses, or timeout.

func (*Harness) WaitForApplicationsCount added in v1.1.0

func (h *Harness) WaitForApplicationsCount(deviceId string, expectedCount int, statuses ...v1beta1.ApplicationStatusType)

WaitForApplicationsCount waits for the number of applications to match the expected count.

func (*Harness) WaitForApplicationsSummaryNotHealthy added in v1.1.0

func (h *Harness) WaitForApplicationsSummaryNotHealthy(deviceID string)

WaitForApplicationsSummaryNotHealthy waits until applications summary status is set and not Healthy.

func (*Harness) WaitForApplicationsSummaryStatus added in v1.1.0

func (h *Harness) WaitForApplicationsSummaryStatus(deviceId string, expectedStatus v1beta1.ApplicationsSummaryStatusType)

WaitForApplicationsSummaryStatus waits for the device's ApplicationsSummary status to match the expected status

func (*Harness) WaitForBatchStart added in v0.8.1

func (h *Harness) WaitForBatchStart(fleetName string, batchNumber int)

func (*Harness) WaitForBootstrapAndUpdateToVersion added in v0.4.0

func (h *Harness) WaitForBootstrapAndUpdateToVersion(deviceId string, version string) (*v1beta1.Device, util.ImageReference, error)

func (*Harness) WaitForClusterRegistered added in v0.8.1

func (h *Harness) WaitForClusterRegistered(deviceId string, timeout time.Duration) error

func (*Harness) WaitForDeviceContents added in v0.3.0

func (h *Harness) WaitForDeviceContents(deviceId string, description string, condition func(*v1beta1.Device) bool, timeout string)

func (*Harness) WaitForDeviceNewGeneration added in v0.6.0

func (h *Harness) WaitForDeviceNewGeneration(deviceId string, newGeneration int64) (err error)

func (*Harness) WaitForDeviceNewRenderedVersion added in v0.4.0

func (h *Harness) WaitForDeviceNewRenderedVersion(deviceId string, newRenderedVersionInt int) (err error)

func (*Harness) WaitForDeviceNewRenderedVersionWithReboot added in v1.1.0

func (h *Harness) WaitForDeviceNewRenderedVersionWithReboot(deviceId string, newRenderedVersionInt int) (err error)

WaitForDeviceNewRenderedVersionWithReboot waits for the device to reach the target rendered version after an update that causes a reboot. Use only when the update triggers a device reboot. Otherwise, use WaitForDeviceNewRenderedVersion.

func (*Harness) WaitForDeviceWithSystemInfo added in v1.2.0

func (h *Harness) WaitForDeviceWithSystemInfo(deviceID, timeout, polling string) (*v1beta1.Device, error)

WaitForDeviceWithSystemInfo polls until the Device exists and reports populated systemInfo.

func (*Harness) WaitForEnrollmentIDFromAgentLogs added in v1.2.0

func (h *Harness) WaitForEnrollmentIDFromAgentLogs(timeout, polling string) (string, error)

WaitForEnrollmentIDFromAgentLogs polls the flightctl-agent logs until an enrollment ID is present.

func (*Harness) WaitForEnrollmentRequest

func (h *Harness) WaitForEnrollmentRequest(id string) *v1beta1.EnrollmentRequest

func (*Harness) WaitForEnrollmentRequestResource added in v1.2.0

func (h *Harness) WaitForEnrollmentRequestResource(enrollmentID, timeout, polling string) (*v1beta1.EnrollmentRequest, error)

WaitForEnrollmentRequestResource polls until the expected EnrollmentRequest exists.

func (*Harness) WaitForFileInDevice added in v0.8.1

func (h *Harness) WaitForFileInDevice(filePath string, timeout string, polling string) (*bytes.Buffer, error)

func (*Harness) WaitForFleetContents added in v0.9.0

func (h *Harness) WaitForFleetContents(fleetName string, description string, condition func(fleet *v1beta1.Fleet) bool, timeout string)

func (*Harness) WaitForFleetCount added in v1.1.0

func (h *Harness) WaitForFleetCount(params *v1beta1.ListFleetsParams, expectedCount int, timeout, polling time.Duration)

func (*Harness) WaitForFleetUpdateToFail added in v0.8.1

func (h *Harness) WaitForFleetUpdateToFail(fleetName string)

func (*Harness) WaitForImageBuildCompletion added in v1.1.0

func (h *Harness) WaitForImageBuildCompletion(name string, timeout time.Duration) (*imagebuilderapi.ImageBuild, error)

WaitForImageBuildCompletion waits for an ImageBuild to complete successfully.

func (*Harness) WaitForImageBuildCondition added in v1.1.0

func (h *Harness) WaitForImageBuildCondition(name string, expectedReason imagebuilderapi.ImageBuildConditionReason, timeout, polling time.Duration) error

WaitForImageBuildCondition waits for an ImageBuild to reach a specific condition reason.

func (*Harness) WaitForImageBuildFailure added in v1.1.0

func (h *Harness) WaitForImageBuildFailure(name string, timeout time.Duration) (*imagebuilderapi.ImageBuild, error)

WaitForImageBuildFailure waits for an ImageBuild to fail.

func (*Harness) WaitForImageBuildProcessing added in v1.1.0

func (h *Harness) WaitForImageBuildProcessing(name string, timeout, polling time.Duration) (*imagebuilderapi.ImageBuild, error)

WaitForImageBuildProcessing waits for an ImageBuild to start processing (leave Pending state). Returns the ImageBuild once it's in Building, Pushing, Completed, or another non-Pending state that is not a terminal failure. If the Ready condition becomes Failed, returns immediately with an error (does not wait for timeout).

func (*Harness) WaitForImageBuildWithLogs added in v1.1.0

func (h *Harness) WaitForImageBuildWithLogs(name string, timeout time.Duration) (*imagebuilderapi.ImageBuild, error)

WaitForImageBuildWithLogs streams logs for an ImageBuild until completion or timeout. Caller should first call WaitForImageBuildProcessing to ensure the build has started. Returns the final ImageBuild resource and any error. Transient stream errors (e.g. TLS connection issues) are retried automatically.

func (*Harness) WaitForImageExportCompletion added in v1.2.0

func (h *Harness) WaitForImageExportCompletion(name string, timeout time.Duration) (*imagebuilderapi.ImageExport, string, error)

WaitForImageExportCompletion waits for an ImageExport to reach a terminal condition (Completed, Failed, or Canceled). It returns the export, the condition reason (e.g. "Completed", "Failed", "Canceled"), and an error. Error is non-nil only on API failure (e.g. GetImageExport) or timeout; on terminal state, status is set and err is nil.

func (*Harness) WaitForImageExportCondition added in v1.2.0

func (h *Harness) WaitForImageExportCondition(name string, expectedReason imagebuilderapi.ImageExportConditionReason, timeout, polling time.Duration) error

WaitForImageExportCondition waits for an ImageExport to reach a specific condition reason.

func (*Harness) WaitForImageExportProcessing added in v1.1.0

func (h *Harness) WaitForImageExportProcessing(name string, timeout, polling time.Duration) (*imagebuilderapi.ImageExport, error)

WaitForImageExportProcessing waits for an ImageExport to start processing (leave Pending state).

func (*Harness) WaitForImageExportWithLogs added in v1.1.0

func (h *Harness) WaitForImageExportWithLogs(name string, timeout time.Duration) (*imagebuilderapi.ImageExport, error)

WaitForImageExportWithLogs streams logs for an ImageExport until completion or timeout. Transient stream errors (e.g. TLS connection issues) are retried automatically.

func (*Harness) WaitForMicroshiftReady added in v1.2.0

func (h *Harness) WaitForMicroshiftReady(kubeconfigPath string) error

WaitForMicroshiftReady waits for all pods in the microshift cluster to reach Ready status.

func (*Harness) WaitForNoApplications added in v1.1.0

func (h *Harness) WaitForNoApplications(deviceId string)

WaitForNoApplications waits for the device to have no applications in status

func (*Harness) WaitForNoPodsInNamespace added in v1.2.0

func (h *Harness) WaitForNoPodsInNamespace(namespace string, timeout time.Duration) error

WaitForNoPodsInNamespace waits until there are no pods in the specified namespace.

func (*Harness) WaitForPodmanImagePresence added in v1.1.0

func (h *Harness) WaitForPodmanImagePresence(imageRef string, shouldExist bool)

WaitForPodmanImagePresence waits until a podman image is present/absent on the VM.

func (*Harness) WaitForRepositoryAccessible added in v1.1.0

func (h *Harness) WaitForRepositoryAccessible(name string, timeout, polling time.Duration) error

WaitForRepositoryAccessible waits for a repository to have its Accessible condition set to True.

func (*Harness) WaitForRepositoryNotAccessible added in v1.1.0

func (h *Harness) WaitForRepositoryNotAccessible(name string, timeout, polling time.Duration) error

WaitForRepositoryNotAccessible waits for a repository to have its Accessible condition set to False.

func (*Harness) WaitForResourceSyncCondition added in v1.1.0

func (h *Harness) WaitForResourceSyncCondition(name string, condType v1beta1.ConditionType, expectedStatus v1beta1.ConditionStatus, timeout, polling time.Duration)

func (*Harness) WaitForResourceSyncStatus added in v0.10.0

func (h *Harness) WaitForResourceSyncStatus(name string, expectedStatus v1beta1.ConditionStatus, timeout string) error

WaitForResourceSyncStatus waits for a ResourceSync to reach a specific status

func (*Harness) WaitForRunningApplicationsCount added in v1.1.0

func (h *Harness) WaitForRunningApplicationsCount(deviceId string, expectedCount int)

WaitForRunningApplicationsCount waits for a specific number of applications to reach Running status

func (*Harness) WaitForSystemdUnitStatus added in v1.0.0

func (h *Harness) WaitForSystemdUnitStatus(deviceID, unitName string, timeout, polling any) v1beta1.SystemdUnitStatus

WaitForSystemdUnitStatus waits until the requested unit appears in status.systemd and returns it. timeout and polling mirror Gomega Eventually args (string or time.Duration).

func (*Harness) WaitForSystemdUnitsLen added in v1.0.0

func (h *Harness) WaitForSystemdUnitsLen(deviceID string, expectedLen int, timeout, polling any) int

WaitForSystemdUnitsLen waits until status.systemd has the expected number of units. Returns the final length for convenience.

func (*Harness) WaitForVulnerabilitySyncComplete added in v1.2.0

func (h *Harness) WaitForVulnerabilitySyncComplete(v1alpha1Client *v1alpha1client.ClientWithResponses, timeout, interval time.Duration)

WaitForVulnerabilitySyncComplete waits for the vulnerability sync to detect CVEs.

func (*Harness) WaitImageBuilderResourcePhase added in v1.2.0

func (h *Harness) WaitImageBuilderResourcePhase(
	kind ImageBuilderResourceKind,
	name string,
	phase ImageBuilderWaitPhase,
	wantReason string,
	timeout, poll time.Duration,
	byStep string,
) error

WaitImageBuilderResourcePhase polls until the desired processing / condition / deleted state. wantReason is used only when phase == ImageBuilderWaitConditionReason. byStep is optional Ginkgo By text (empty skips By).

func (*Harness) WriteAgentFile added in v1.2.0

func (h *Harness) WriteAgentFile(path, content string) error

WriteAgentFile writes content to a file on the VM while suppressing payload echo in stdout.

type ImageBuilderResourceKind added in v1.2.0

type ImageBuilderResourceKind int

ImageBuilderResourceKind selects ImageBuild vs ImageExport for WaitImageBuilderResourcePhase.

const (
	ImageBuilderResourceKindBuild ImageBuilderResourceKind = iota
	ImageBuilderResourceKindExport
)

type ImageBuilderWaitPhase added in v1.2.0

type ImageBuilderWaitPhase int

ImageBuilderWaitPhase selects which terminal state to wait for in WaitImageBuilderResourcePhase.

const (
	// ImageBuilderWaitProcessing waits until the resource leaves Pending (harness WaitFor*Processing).
	ImageBuilderWaitProcessing ImageBuilderWaitPhase = iota
	// ImageBuilderWaitConditionReason waits until Ready condition reason equals wantReason.
	ImageBuilderWaitConditionReason
	// ImageBuilderWaitDeleted waits until Get returns HTTP 404 (resource removed).
	ImageBuilderWaitDeleted
)

type InlineComposeVolume added in v1.2.0

type InlineComposeVolume struct {
	Name       string
	Reference  string
	PullPolicy v1beta1.ImagePullPolicy
}

InlineComposeVolume describes a volume for CreateFleetWithInlineComposeAndVolumes.

type InlineContent added in v1.1.0

type InlineContent struct {
	Path    string
	Content string
}

type LoginFunc added in v1.2.0

type LoginFunc func(h *Harness) error

LoginFunc is a function that logs in a user on the given harness.

type PromQueryResponse added in v1.1.0

type PromQueryResponse struct {
	Status string `json:"status"`
	Data   struct {
		Result []struct {
			Metric map[string]string `json:"metric"`
			Value  []interface{}     `json:"value"`
		} `json:"result"`
	} `json:"data"`
}

PromQueryResponse represents a Prometheus query response.

type RbacDownloadExpectation added in v1.2.0

type RbacDownloadExpectation int

RbacDownloadExpectation selects forbidden vs successful ImageExport download in RBAC denial flows.

const (
	// RbacDownloadForbidden expects HTTP 403 on download.
	RbacDownloadForbidden RbacDownloadExpectation = iota
	// RbacDownloadSuccess expects a successful download (e.g. installer role).
	RbacDownloadSuccess
)

type RbacReadOpts added in v1.2.0

type RbacReadOpts struct {
	IncludeBuildLogs  bool
	IncludeExportLogs bool
	RoleLabel         string
}

RbacReadOpts configures optional log endpoints for read-only RBAC helpers (access only; no content checks).

type RenderedAppRefs added in v1.2.0

type RenderedAppRefs struct {
	ContainerImage  string // image from the container app
	ContainerVolRef string // first image-backed volume ref from the container app
	QuadletImage    string // image from the quadlet image app
	QuadletVolRef   string // first image-backed volume ref from the quadlet image app
	InlineContent   string // inline content from the inline quadlet app
}

RenderedAppRefs holds extracted image references and inline content from a device's applications.

type ResourceTestConfig added in v1.1.0

type ResourceTestConfig struct {
	Resources     []string
	ShouldSucceed bool
}

ResourceTestConfig represents a test configuration for resource operations with different success expectations per resource group

type SBOMValidationResult added in v1.2.0

type SBOMValidationResult struct {
	Found          bool
	ImageDigest    string
	ImagePURL      string
	DigestMatches  bool
	ReferrerDigest string
}

SBOMValidationResult contains the result of SBOM validation

type ServiceAccessBackend added in v1.1.0

type ServiceAccessBackend struct {
	ServiceName string
	Namespaces  []string
	Port        int
	UseTLS      bool
	RequireAuth bool
}

type TPMType added in v1.2.0

type TPMType int

TPMType represents the type of TPM hardware detected.

const (
	// TPMTypeSwtpm indicates a software TPM (swtpm) emulator.
	TPMTypeSwtpm TPMType = iota
	// TPMTypeReal indicates real TPM hardware.
	TPMTypeReal
)

func (TPMType) String added in v1.2.0

func (t TPMType) String() string

type VMPool added in v0.10.0

type VMPool struct {
	// contains filtered or unexported fields
}

VMPool manages VMs across all test suites

func GetOrCreateVMPool added in v0.10.0

func GetOrCreateVMPool(config VMPoolConfig) *VMPool

GetOrCreateVMPool returns the global VM pool instance, creating it if necessary

func (*VMPool) CleanupAll added in v0.10.0

func (p *VMPool) CleanupAll() error

CleanupAll cleans up all VMs in the pool

func (*VMPool) CleanupWorkerVM added in v0.10.0

func (p *VMPool) CleanupWorkerVM(workerID int) error

CleanupWorkerVM cleans up the VM for a specific worker

func (*VMPool) GetFreshVMForWorker added in v1.1.0

func (p *VMPool) GetFreshVMForWorker(workerID int) (vm.TestVMInterface, error)

GetFreshVMForWorker returns a fresh VM without snapshots for the given worker ID. Fresh VMs use qcow2 overlays (like regular VMs) but don't support snapshot/revert. This is useful for tests that need clean VMs without snapshot complexity or where snapshot revert causes issues.

func (*VMPool) GetVMForWorker added in v0.10.0

func (p *VMPool) GetVMForWorker(workerID int) (vm.TestVMInterface, error)

GetVMForWorker returns a VM for the given worker ID, creating it on-demand if it doesn't exist. This method supports lazy VM creation to optimize resource usage.

type VMPoolConfig added in v0.10.0

type VMPoolConfig struct {
	BaseDiskPath string
	TempDir      string
	SSHPortBase  int
}

VMPoolConfig holds configuration for the VM pool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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