Documentation
¶
Index ¶
- Constants
- Variables
- func BuildAppSpec(appName string, appType v1beta1.AppType, provider any) (v1beta1.ApplicationProviderSpec, error)
- func BuildImageAppSpec(appName string, appType v1beta1.AppType, image string) (v1beta1.ApplicationProviderSpec, error)
- func BuildInlineAppSpec(appName string, appType v1beta1.AppType, contents []InlineContent) (v1beta1.ApplicationProviderSpec, error)
- func Cleanup(h *Harness)
- func ConditionExists(d *v1beta1.Device, condType v1beta1.ConditionType, ...) bool
- func ConditionStatusExists(conditions []v1beta1.Condition, condType v1beta1.ConditionType, ...) bool
- func CreateFailingServiceOnDevice(h *Harness, serviceName string) error
- func CreateInlineApplicationSpec(inlineAppComposeYaml, filename string) v1beta1.InlineApplicationProviderSpec
- func ExecuteReadOnlyResourceOperations(harness *Harness, resourceTypes []string, shouldSucceed bool) error
- func ExecuteResourceOperations(ctx context.Context, harness *Harness, resourceTypes []string, ...) error
- func ExtractAuthURL(provider *v1beta1.AuthProvider) string
- func GetBaseDiskPath() (string, error)
- func GetContext() (string, error)
- func GetDeviceConfig[T any](device *v1beta1.Device, configType v1beta1.ConfigProviderType, ...) (T, error)
- func GetRenderedVersion(device *v1beta1.Device) (int, error)
- func GetSSHPrivateKey() (string, error)
- func GetSSHPrivateKeyPath() (string, error)
- func GetSSHPublicKeyPath() (string, error)
- func GetTestDataPath(relativePath string) string
- func GetWorkerContext() context.Context
- func GinkgoBeforeSuite()
- func HaveReason(expected string) types.GomegaMatcher
- func HaveStatus(expected v1beta1.ConditionStatus) types.GomegaMatcher
- func IsDeviceUpdateObserved(device *v1beta1.Device, expectedVersion int) bool
- func NewContainerApplicationSpec(name string, image string, ports []v1beta1.ApplicationPort, ...) (v1beta1.ApplicationProviderSpec, error)
- func NewImageBuildSpec(sourceRepo, sourceImage, sourceTag, destRepo, destImage, destTag string, ...) imagebuilderapi.ImageBuildSpec
- func NewImageBuildSpecWithUserConfig(sourceRepo, sourceImage, sourceTag, destRepo, destImage, destTag string, ...) imagebuilderapi.ImageBuildSpec
- func NewImageExportSpec(imageBuildName string, format imagebuilderapi.ExportFormatType) imagebuilderapi.ImageExportSpec
- func NewMountVolume(name, mountPath string) (v1beta1.ApplicationVolume, error)
- func RemoveSystemdService(h *Harness, serviceName string) error
- func RemoveVMFromPool(workerID int) error
- func RestoreServiceOnDevice(h *Harness, serviceName string) error
- func SetupVMForWorker(workerID int, tempDir string, sshPortBase int) (vm.TestVMInterface, error)
- func StopServiceOnDevice(h *Harness, serviceName string) error
- func TestResourceOperations(ctx context.Context, harness *Harness, operations []string, ...) error
- func UpdateDeviceApplicationFromInline(device *v1beta1.Device, appName string, ...) error
- func WriteEvidence(dir, filename, command, output string, err error) error
- type APIError
- type ConsoleSession
- type GitServerConfig
- type Harness
- func GetWorkerHarness() *Harness
- func NewTestHarnessWithVMPool(ctx context.Context, workerID int) (*Harness, error)
- func NewTestHarnessWithoutVM(ctx context.Context) (*Harness, error)
- func SetupWorkerHarness() (*Harness, context.Context, error)
- func SetupWorkerHarnessWithoutVM() (*Harness, context.Context, error)
- func (h *Harness) AddConfigToDeviceWithRetries(deviceId string, config v1beta1.ConfigProviderSpec) error
- func (h *Harness) AddLabelsToYAML(yamlContent string, addLabels map[string]string) (string, error)
- func (h *Harness) ApiEndpoint() string
- func (h *Harness) ApplyResource(yamlPath string) (string, error)
- func (h *Harness) ApplyTempIfSuggested(out string, cliErr error) error
- func (h *Harness) ApproveEnrollment(id string, approval *v1beta1.EnrollmentRequestApproval)
- func (h *Harness) CLI(args ...string) (string, error)
- func (h *Harness) CLIWithEnvAndShell(env map[string]string, shellCommand string) (string, error)
- func (h *Harness) CLIWithStdin(stdin string, args ...string) (string, error)
- func (h *Harness) CancelImageBuild(name string) error
- func (h *Harness) CancelImageExport(name string) error
- func (h *Harness) CaptureHostCLI(artifactDir, filename string, args ...string) error
- func (h *Harness) CaptureStandardEvidence(artifactDir, deviceID string) error
- func (h *Harness) CaptureVMCommand(artifactDir, filename, command string, optional bool) error
- func (h *Harness) ChangeK8sContext(ctx context.Context, k8sContext string) (string, error)
- func (h *Harness) ChangeK8sNamespace(namespace string) error
- func (h *Harness) CheckApplicationComposeFileExist(applicationName string, ComposeFile string) error
- func (h *Harness) CheckApplicationDirectoryExist(applicationName string) error
- func (h Harness) CheckApplicationStatus(deviceId string, applicationName string) (v1beta1.ApplicationStatusType, error)
- func (h *Harness) CheckDeviceStatus(deviceId string, status v1beta1.DeviceSummaryStatusType) (*v1beta1.Device, error)
- func (h *Harness) CheckEnvInjectedToApplication(envVarName string, image string) (string, error)
- func (h *Harness) CheckRunningContainers() (string, error)
- func (h *Harness) CleanUpAllTestResources() error
- func (h *Harness) CleanUpResource(resourceType string, resourceName string) (string, error)
- func (h *Harness) CleanUpTestResources(resourceTypes ...string) error
- func (h *Harness) Cleanup(printConsole bool)
- func (h *Harness) CleanupClusterRoles(ctx context.Context, kubernetesClient kubernetes.Interface, ...)
- func (h *Harness) CleanupGitRepositories() error
- func (h *Harness) CleanupRoles(ctx context.Context, kubernetesClient kubernetes.Interface, roles []string, ...)
- func (h *Harness) CloneGitRepositoryFromServer(repoName, localPath string) error
- func (h *Harness) CommitAndPushGitRepo(workDir, commitMessage string) error
- func (h *Harness) CreateCloudInitDir(tempDir, vmName, agentConfig string) (string, error)
- func (h *Harness) CreateClusterRole(ctx context.Context, kubernetesClient kubernetes.Interface, ...) (*rbacv1.ClusterRole, error)
- func (h *Harness) CreateClusterRoleBinding(ctx context.Context, kubernetesClient kubernetes.Interface, ...) (*rbacv1.ClusterRoleBinding, error)
- func (h *Harness) CreateDeviceConfigInGitRepo(repoName, deviceName string, deviceSpec v1beta1.DeviceSpec) error
- func (h *Harness) CreateFleetConfigInGitRepo(repoName, fleetName string, fleetSpec v1beta1.FleetSpec) error
- func (h *Harness) CreateFleetDeviceSpec(deviceImageTag string, additionalConfigs ...v1beta1.ConfigProviderSpec) (v1beta1.DeviceSpec, error)
- func (h *Harness) CreateGitRepository(repoName string, repositorySpec domain.RepositorySpec) error
- func (h *Harness) CreateGitRepositoryNoAuth(name, url string) (*v1beta1.Repository, error)
- func (h *Harness) CreateGitRepositoryOnServer(repoName string) error
- func (h *Harness) CreateGitRepositoryWithContent(repoName, filePath, content string, repositorySpec v1beta1.RepositorySpec) error
- func (h *Harness) CreateHTTPRepository(name, url string, username, password *string) (*v1beta1.Repository, error)
- func (h *Harness) CreateImageBuild(name string, spec imagebuilderapi.ImageBuildSpec) (*imagebuilderapi.ImageBuild, error)
- func (h *Harness) CreateImageBuildWithLabels(name string, spec imagebuilderapi.ImageBuildSpec, labels map[string]string) (*imagebuilderapi.ImageBuild, error)
- func (h *Harness) CreateImageExport(name string, spec imagebuilderapi.ImageExportSpec) (*imagebuilderapi.ImageExport, error)
- func (h *Harness) CreateOrUpdateTestFleet(testFleetName string, fleetSpecOrSelector interface{}, ...) error
- func (h *Harness) CreateRepository(repositorySpec v1beta1.RepositorySpec, metadata v1beta1.ObjectMeta) error
- func (h *Harness) CreateRepositoryWithSSHCredentials(repoName, repoURL, sshPrivateKey string) error
- func (h *Harness) CreateRepositoryWithValidE2ECredentials(repoName string) error
- func (h *Harness) CreateResource(resourceType string) (string, string, []byte, error)
- func (h *Harness) CreateResourceSync(name, repoName string, spec v1beta1.ResourceSyncSpec) error
- func (h *Harness) CreateResourceSyncForRepo(resourceSyncName, repoName, branchName string) error
- func (h *Harness) CreateRole(ctx context.Context, kubernetesClient kubernetes.Interface, flightCtlNs string, ...) (*rbacv1.Role, error)
- func (h *Harness) CreateRoleBinding(ctx context.Context, kubernetesClient kubernetes.Interface, flightCtlNs string, ...) (*rbacv1.RoleBinding, error)
- func (h *Harness) CreateTestFleetWithConfig(testFleetName string, testFleetSelector v1beta1.LabelSelector, ...) error
- func (h *Harness) DeleteClusterRole(ctx context.Context, client kubernetes.Interface, clusterRoleName string) error
- func (h *Harness) DeleteClusterRoleBinding(ctx context.Context, client kubernetes.Interface, ...) error
- func (h *Harness) DeleteFleet(testFleetName string) error
- func (h *Harness) DeleteGitRepositoryOnServer(repoName string) error
- func (h *Harness) DeleteImageBuild(name string) error
- func (h *Harness) DeleteImageExport(name string) error
- func (h *Harness) DeleteRepository(name string) error
- func (h *Harness) DeleteResourceSync(name string) error
- func (h *Harness) DeleteRole(ctx context.Context, client kubernetes.Interface, namespace string, ...) error
- func (h *Harness) DeleteRoleBinding(ctx context.Context, client kubernetes.Interface, namespace string, ...) error
- func (h *Harness) DownloadImageExport(name string) (io.ReadCloser, int64, error)
- func (h *Harness) DropinCleanupFunc(artifactDir, filename, command string) func()
- func (h *Harness) EditWithRetry(format, editor, resource string) (string, error)
- func (h *Harness) EnableTPMForDevice() error
- func (h *Harness) EnrollAndWaitForOnlineStatus(labels ...map[string]string) (string, *v1beta1.Device)
- func (h *Harness) EnsureArtifactDir(testCase string) (string, error)
- func (h *Harness) EnsureDeviceContents(deviceId string, description string, condition func(*v1beta1.Device) bool, ...)
- func (h *Harness) EnsureDeviceSimulatorBinary() (string, error)
- func (h *Harness) ExtractSingleContainerNameFromVM() (string, error)
- func (h *Harness) FetchMetrics(url string) (string, error)
- func (h *Harness) FixNetworkFailure() error
- func (h *Harness) FixNetworkFailureForCLI(ip, port string) error
- func (h *Harness) FleetExists(fleetName string) bool
- func (h *Harness) GenerateEnrollmentConfig(csrName string) (string, error)
- func (h *Harness) GenerateFleetYAMLsForSimulator(fleetCount, devicesPerFleet int, fleetBaseName string) (string, error)
- func (h *Harness) GetAgentVersion() (string, error)
- func (h *Harness) GetAgentVersionFromLogs() (string, error)
- func (h *Harness) GetCertificateSigningRequestByYaml(csrYaml string) v1beta1.CertificateSigningRequest
- func (h *Harness) GetConfigMapValue(namespace, name, jsonPath string) (string, error)
- func (h *Harness) GetContainerPorts() (string, error)
- func (h *Harness) GetCurrentDeviceGeneration(deviceId string) (deviceRenderedVersionInt int64, err error)
- func (h *Harness) GetCurrentDeviceRenderedVersion(deviceId string) (int, error)
- func (h *Harness) GetDefaultK8sContext() (string, error)
- func (h *Harness) GetDevice(deviceId string) (*v1beta1.Device, error)
- func (h *Harness) GetDeviceByYaml(deviceYaml string) v1beta1.Device
- func (h *Harness) GetDeviceFromTestContext() (string, *v1beta1.Device, bool)
- func (h *Harness) GetDeviceGitConfig(device *v1beta1.Device, configName string) (v1beta1.GitConfigProviderSpec, error)
- func (h *Harness) GetDeviceHttpConfig(device *v1beta1.Device, configName string) (v1beta1.HttpConfigProviderSpec, error)
- func (h *Harness) GetDeviceInlineConfig(device *v1beta1.Device, configName string) (v1beta1.InlineConfigProviderSpec, error)
- func (h *Harness) GetDeviceOsImage(device *v1beta1.Device) (image string, err error)
- func (h *Harness) GetDeviceSystemInfo(deviceID string) *v1beta1.DeviceSystemInfo
- func (h *Harness) GetDeviceWithStatusSummary(enrollmentID string) (v1beta1.DeviceSummaryStatusType, error)
- func (h *Harness) GetDeviceWithStatusSystem(enrollmentID string) (*apiclient.GetDeviceResponse, error)
- func (h *Harness) GetDeviceWithUpdateStatus(enrollmentID string) (v1beta1.DeviceUpdatedStatusType, error)
- func (h *Harness) GetEnrollmentIDFromServiceLogs(serviceName string) string
- func (h *Harness) GetEnrollmentRequestByYaml(erYaml string) *v1beta1.EnrollmentRequest
- func (h *Harness) GetFleet(fleetName string) (*v1beta1.Fleet, error)
- func (h *Harness) GetFleetByYaml(fleetYaml string) v1beta1.Fleet
- func (h *Harness) GetFlightctlAgentLogs() (string, error)
- func (h *Harness) GetFlightctlPath() string
- func (h *Harness) GetFreeLocalPort() (int, error)
- func (h *Harness) GetGitRepoURL(repoName string) (string, error)
- func (h *Harness) GetGitServerConfig() (GitServerConfig, error)
- func (h *Harness) GetImageBuild(name string) (*imagebuilderapi.ImageBuild, error)
- func (h *Harness) GetImageBuildConditionReason(name string) (string, error)
- func (h *Harness) GetImageBuildConditionReasonAndMessage(name string) (reason, message string, err error)
- func (h *Harness) GetImageBuildLogs(name string) (string, error)
- func (h *Harness) GetImageExport(name string) (*imagebuilderapi.ImageExport, error)
- func (h *Harness) GetImageExportConditionReason(name string) (string, error)
- func (h *Harness) GetImageExportLogs(name string) (string, error)
- func (h *Harness) GetInternalGitRepoURL(repoName string) (string, error)
- func (h *Harness) GetK8sApiEndpoint(ctx context.Context, k8sContext string) (string, error)
- func (h *Harness) GetMaxConcurrentBuilds() (int, error)
- func (h *Harness) GetOrganizationID() (string, error)
- func (h *Harness) GetRepository(repositoryName string) (*v1beta1.Repository, error)
- func (h *Harness) GetRepositoryByYaml(repoYaml string) v1beta1.Repository
- func (h *Harness) GetResourceSync(name string) (*v1beta1.ResourceSync, error)
- func (h *Harness) GetResourceSyncByYaml(rSyncYaml string) v1beta1.ResourceSync
- func (h *Harness) GetResourceSyncConditionMessage(name string, condType v1beta1.ConditionType) (string, error)
- func (h *Harness) GetResourcesByName(resourceType string, resourceName ...string) (string, error)
- func (h *Harness) GetRolloutStatus(fleetName string) (v1beta1.Condition, error)
- func (h *Harness) GetSelectedDevicesForBatch(fleetName string) ([]*v1beta1.Device, error)
- func (h *Harness) GetServiceLogs(serviceName string) (string, error)
- func (h *Harness) GetTestContext() context.Context
- func (h *Harness) GetTestDataFromContext(key string) (interface{}, bool)
- func (h *Harness) GetTestIDFromContext() string
- func (h *Harness) GetUnavailableDevicesPerGroup(fleetName string, groupBy []string) (map[string][]*v1beta1.Device, error)
- func (h *Harness) GetUpdatedDevices(fleetName string) ([]*v1beta1.Device, error)
- func (h *Harness) GetVMFromPool(workerID int) (vm.TestVMInterface, error)
- func (h *Harness) GetVersionsFromCLI() (clientVersion, serverVersion, agentVersion string, err error)
- func (h *Harness) GetYAML(name string) (string, error)
- func (h *Harness) HeadlessEditorWrapper(marker string) (string, error)
- func (h *Harness) ImageBuildExists(name string) bool
- func (h *Harness) ImageExportExists(name string) bool
- func (h *Harness) IsRepositoryAccessible(name string) (bool, error)
- func (h *Harness) KillImageBuilderWorkerPods() error
- func (h *Harness) ListImageBuilds(params *imagebuilderapi.ListImageBuildsParams) (*imagebuilderapi.ImageBuildList, error)
- func (h *Harness) ListImageExports(params *imagebuilderapi.ListImageExportsParams) (*imagebuilderapi.ImageExportList, error)
- func (h *Harness) ListRepositories() (*v1beta1.RepositoryList, error)
- func (h *Harness) ManageResource(operation, resource string, args ...string) (string, error)
- func (h *Harness) MarkClientAccessTokenExpired(filePath string) error
- func (h *Harness) MetricsBody(url string) func() string
- func (h *Harness) MetricsLineCount(url string) func() int
- func (h *Harness) MetricsMatchLabels(url string, exact map[string]string, required, requiredNonEmpty []string) func() bool
- func (h *Harness) NewConsoleSession(deviceID string) *ConsoleSession
- func (h *Harness) OTelcolActiveStatus() func() string
- func (h *Harness) PrepareNextDeviceGeneration(deviceId string) (int64, error)
- func (h *Harness) PrepareNextDeviceVersion(deviceId string) (int, error)
- func (h *Harness) PrintAgentLogsIfFailed()
- func (h *Harness) PromQuery(baseURL, query string) (PromQueryResponse, error)
- func (h *Harness) PromQueryCountValue(promURL, query string) func() float64
- func (h *Harness) PromQueryHasLabels(promURL, query string, exact map[string]string, required []string) func() bool
- func (h *Harness) PromQueryResultCount(promURL, query string) func() int
- func (h *Harness) PushContentToGitServerRepo(repoName, filePath, content, commitMessage string) error
- func (h *Harness) PushContentToGitServerRepoFromPath(repoName, sourcePath, commitMessage string) error
- func (h *Harness) PushTemplatedFilesToGitRepo(repoName, sourceDir, workDir string, data interface{}) error
- func (h *Harness) QuadletImageAppSpec(name, image string, envVars map[string]string) (v1beta1.ApplicationProviderSpec, error)
- func (h *Harness) ReadClientConfig(filePath string) (*client.Config, error)
- func (h *Harness) ReadPrimaryVMAgentLogs(since string, unit string) (string, error)
- func (h *Harness) RebootVMAndWaitForSSH(waitInterval time.Duration, maxAttempts int) error
- func (h *Harness) RefreshClient() error
- func (h *Harness) RegistryEndpoint() string
- func (h *Harness) ReloadFlightCtlAgent() error
- func (h *Harness) ReplaceRepository(repositorySpec v1beta1.RepositorySpec, metadata v1beta1.ObjectMeta) error
- func (h *Harness) ReplaceResourceSync(name, repoName string, spec v1beta1.ResourceSyncSpec) error
- func (h *Harness) ReplaceVariableInString(s string, old string, new string) string
- func (h *Harness) ResetAgent() error
- func (h *Harness) ResolveImage(registry, imageName, tag string) (ocispec.Descriptor, error)
- func (h *Harness) RestartFlightCtlAgent() error
- func (h *Harness) RunConsoleCommand(deviceID string, flags []string, cmd ...string) (string, error)
- func (h *Harness) RunDeviceSimulator(_ context.Context, args ...string) (*exec.Cmd, error)
- func (h *Harness) RunGetDevices(args ...string) (string, error)
- func (h *Harness) RunGetEvents(args ...string) (string, error)
- func (h *Harness) RunInteractiveCLI(args ...string) (io.WriteCloser, io.ReadCloser, error)
- func (h *Harness) RunPodmanPsContainerNames(allContainers bool) (string, error)
- func (h *Harness) RunVMCommandWithEvidence(artifactDir, filename, command string) (string, error)
- func (h *Harness) SH(command string, args ...string) (string, error)
- func (h *Harness) SHWithStdin(stdin, command string, args ...string) (string, error)
- func (h *Harness) SetAgentConfig(cfg *agentcfg.Config) error
- func (h *Harness) SetDeviceApplications(deviceID string, apps *[]v1beta1.ApplicationProviderSpec) error
- func (h *Harness) SetLabelsForDevice(deviceId string, labels map[string]string) error
- func (h *Harness) SetLabelsForDeviceMetadata(metadata *v1beta1.ObjectMeta, labels map[string]string)
- func (h *Harness) SetLabelsForDevicesByIndex(deviceIDs []string, labelsList []map[string]string, fleetName string) error
- func (h *Harness) SetLabelsForFleetMetadata(metadata *v1beta1.ObjectMeta, labels map[string]string)
- func (h *Harness) SetLabelsForRepositoryMetadata(metadata *v1beta1.ObjectMeta, labels map[string]string)
- func (h *Harness) SetLabelsForResource(metadata *v1beta1.ObjectMeta, labels map[string]string)
- func (h *Harness) SetMaxConcurrentBuilds(maxConcurrentBuilds int) error
- func (h *Harness) SetTestContext(ctx context.Context)
- func (h *Harness) SetupDeviceSimulatorAgentConfig(specFetch time.Duration, statusUpdate time.Duration) (string, error)
- func (h *Harness) SetupDeviceWithTPM(workerID int) error
- func (h *Harness) SetupScenario(deviceID, testCase string) (string, error)
- func (h *Harness) SetupTemplatedGitRepoFromDir(repoName, sourceDir string, data interface{}) (string, error)
- func (h *Harness) SetupVMFromPool(workerID int) error
- func (h *Harness) SetupVMFromPoolAndStartAgent(workerID int) error
- func (h *Harness) SimulateNetworkFailure() error
- func (h *Harness) SimulateNetworkFailureForCLI(ip, port string) (func() error, error)
- func (h *Harness) StartFlightCtlAgent() error
- func (h *Harness) StartPortForward(ctx context.Context, namespace, target string, localPort, remotePort int) (*exec.Cmd, <-chan error, error)
- func (h *Harness) StartPortForwardWithCleanup(namespace, target string, localPort, remotePort int) (func(), error)
- func (h *Harness) StartVMAndEnroll() string
- func (h *Harness) StopDeviceSimulator(cmd *exec.Cmd, timeout time.Duration) error
- func (h *Harness) StopFlightCtlAgent() error
- func (h *Harness) StoreDeviceInTestContext(deviceId string, device *v1beta1.Device)
- func (h *Harness) StoreTestDataInContext(key string, value interface{})
- func (h *Harness) StreamImageBuildLogsWithTimeout(name string, streamDuration time.Duration) (string, error)
- func (h *Harness) StreamImageExportLogsWithTimeout(name string, streamDuration time.Duration) (string, error)
- func (h *Harness) TestEnrollmentApproval(labels ...map[string]string) *v1beta1.EnrollmentRequestApproval
- func (h *Harness) UpdateApplication(withRetries bool, deviceId string, appName string, appProvider any, ...) error
- func (h *Harness) UpdateClusterRole(ctx context.Context, kubernetesClient kubernetes.Interface, ...) (*rbacv1.ClusterRole, error)
- func (h *Harness) UpdateDevice(deviceId string, updateFunction func(*v1beta1.Device)) error
- func (h *Harness) UpdateDeviceAndWait(deviceID string, updateFunc func(device *v1beta1.Device)) error
- func (h *Harness) UpdateDeviceAndWaitForRenderedVersion(deviceID string, updateFunc func(*v1beta1.Device)) error
- func (h *Harness) UpdateDeviceAndWaitForVersion(deviceID string, updateFunc func(device *v1beta1.Device)) error
- func (h *Harness) UpdateDeviceConfigWithRetries(deviceId string, configs []v1beta1.ConfigProviderSpec, nextRenderedVersion int) error
- func (h *Harness) UpdateDeviceWithQuadletInline(deviceID, appName string, paths, contents []string) error
- func (h *Harness) UpdateDeviceWithQuadletInlineAndEnvs(deviceID, appName string, envVars map[string]string, paths, contents []string) error
- func (h *Harness) UpdateDeviceWithRetries(deviceId string, updateFunction func(*v1beta1.Device)) error
- func (h *Harness) UpdateFleet(fleetName string, updateFunc func(*v1beta1.Fleet)) error
- func (h *Harness) UpdateFleetWithRetries(fleetName string, updateFunction func(*v1beta1.Fleet))
- func (h *Harness) UpdateGitServerRepository(repoName, filePath, content, commitMessage string) error
- func (h *Harness) UpdateImageBuilderWorkerConfig(modifier func(*config.Config)) error
- func (h *Harness) UpdateOCIRepositoryRegistry(name, newRegistry string, skipTLSVerify bool) error
- func (h *Harness) UpdateRole(ctx context.Context, kubernetesClient kubernetes.Interface, flightCtlNs string, ...) (*rbacv1.Role, error)
- func (h *Harness) UpdateSystemdMatchPatterns(deviceID string, patterns []string) error
- func (h *Harness) VMCommandOutputFunc(command string, trim bool) func() string
- func (h *Harness) ValidateFleetYAMLDevicesPerFleet(yamlContent string, expectedDevicesPerFleet int, expectedFleetCount int) error
- func (h *Harness) VerifyCommandLacksSubstring(args []string, s string) error
- func (h *Harness) VerifyCommandOutputsSubstring(args []string, s string) error
- func (h *Harness) VerifyContainerCount(count int) error
- func (h *Harness) VerifyContainerRunning(imageSubstring string)
- func (h *Harness) VerifyDeviceTPMAttestationData(device *v1beta1.Device) error
- func (h *Harness) VerifyEnrollmentTPMAttestationData(systemInfo v1beta1.DeviceSystemInfo) error
- func (h *Harness) VerifyQuadletApplicationFolderDeleted(appName string)
- func (h *Harness) VerifyQuadletApplicationFolderExists(appName string)
- func (h *Harness) VerifyQuadletPodmanArgs(appName, flag, expectedValue string)
- func (h *Harness) VerifyServiceExists(namespace, name string) error
- func (h *Harness) VerifyTPMFunctionality() error
- func (h *Harness) WaitForApplicationRunningStatus(deviceId string, applicationImage string)
- func (h *Harness) WaitForApplicationStatus(deviceID, appName string, status v1beta1.ApplicationStatusType, ...) error
- func (h *Harness) WaitForApplicationStatusByName(deviceId string, applicationName string, ...)
- func (h *Harness) WaitForApplicationSummaryDegradedOrError(deviceID string, timeout, polling time.Duration) error
- func (h *Harness) WaitForApplicationsCount(deviceId string, expectedCount int)
- func (h *Harness) WaitForApplicationsSummaryNotHealthy(deviceID string)
- func (h *Harness) WaitForApplicationsSummaryStatus(deviceId string, expectedStatus v1beta1.ApplicationsSummaryStatusType)
- func (h *Harness) WaitForBatchStart(fleetName string, batchNumber int)
- func (h *Harness) WaitForBootstrapAndUpdateToVersion(deviceId string, version string) (*v1beta1.Device, util.ImageReference, error)
- func (h *Harness) WaitForClusterRegistered(deviceId string, timeout time.Duration) error
- func (h *Harness) WaitForDeviceContents(deviceId string, description string, condition func(*v1beta1.Device) bool, ...)
- func (h *Harness) WaitForDeviceNewGeneration(deviceId string, newGeneration int64) (err error)
- func (h *Harness) WaitForDeviceNewRenderedVersion(deviceId string, newRenderedVersionInt int) (err error)
- func (h *Harness) WaitForDeviceNewRenderedVersionWithReboot(deviceId string, newRenderedVersionInt int) (err error)
- func (h *Harness) WaitForEnrollmentRequest(id string) *v1beta1.EnrollmentRequest
- func (h *Harness) WaitForFileInDevice(filePath string, timeout string, polling string) (*bytes.Buffer, error)
- func (h *Harness) WaitForFleetContents(fleetName string, description string, ...)
- func (h *Harness) WaitForFleetCount(params *v1beta1.ListFleetsParams, expectedCount int, ...)
- func (h *Harness) WaitForFleetUpdateToFail(fleetName string)
- func (h *Harness) WaitForImageBuildCompletion(name string, timeout time.Duration) (*imagebuilderapi.ImageBuild, error)
- func (h *Harness) WaitForImageBuildCondition(name string, expectedReason imagebuilderapi.ImageBuildConditionReason, ...) error
- func (h *Harness) WaitForImageBuildFailure(name string, timeout time.Duration) (*imagebuilderapi.ImageBuild, error)
- func (h *Harness) WaitForImageBuildProcessing(name string, timeout, polling time.Duration) (*imagebuilderapi.ImageBuild, error)
- func (h *Harness) WaitForImageBuildWithLogs(name string, timeout time.Duration) (*imagebuilderapi.ImageBuild, error)
- func (h *Harness) WaitForImageBuilderWorkerReady(timeout time.Duration) error
- func (h *Harness) WaitForImageExportProcessing(name string, timeout, polling time.Duration) (*imagebuilderapi.ImageExport, error)
- func (h *Harness) WaitForImageExportWithLogs(name string, timeout time.Duration) (*imagebuilderapi.ImageExport, error)
- func (h *Harness) WaitForNoApplications(deviceId string)
- func (h *Harness) WaitForPodmanImagePresence(imageRef string, shouldExist bool)
- func (h *Harness) WaitForRepositoryAccessible(name string, timeout, polling time.Duration) error
- func (h *Harness) WaitForRepositoryNotAccessible(name string, timeout, polling time.Duration) error
- func (h *Harness) WaitForResourceSyncCondition(name string, condType v1beta1.ConditionType, ...)
- func (h *Harness) WaitForResourceSyncStatus(name string, expectedStatus v1beta1.ConditionStatus, timeout string) error
- func (h *Harness) WaitForRunningApplicationsCount(deviceId string, expectedCount int)
- func (h *Harness) WaitForSystemdUnitStatus(deviceID, unitName string, timeout, polling any) v1beta1.SystemdUnitStatus
- func (h *Harness) WaitForSystemdUnitsLen(deviceID string, expectedLen int, timeout, polling any) int
- func (h *Harness) WaitForTPMInitialization() error
- type InlineContent
- type PromQueryResponse
- type ResourceTestConfig
- type VMPool
- type VMPoolConfig
Constants ¶
const ( OperationCreate = "create" OperationUpdate = "update" OperationGet = "get" OperationList = "list" OperationDelete = "delete" OperationAll = "all" )
Operation constants for RBAC testing
const LONGTIMEOUT = "10m"
const POLLING = "250ms"
const POLLINGLONG = "1s"
const (
// Quadlet unit path on device
QuadletUnitPath = "/etc/containers/systemd"
)
const TIMEOUT = "5m"
Variables ¶
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
var (
InvalidRenderedVersionErr = fmt.Errorf("invalid rendered version")
)
Functions ¶
func BuildAppSpec ¶
func BuildImageAppSpec ¶
func BuildInlineAppSpec ¶
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 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 CreateInlineApplicationSpec ¶
func CreateInlineApplicationSpec(inlineAppComposeYaml, filename string) v1beta1.InlineApplicationProviderSpec
CreateInlineApplicationSpec builds an inline application provider spec from compose yaml content.
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
GetBaseDiskPath finds the base qcow2 disk path
func GetContext ¶ added in v1.0.0
GetContext returns the Kubernetes context (KIND or OCP) or an error
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 GetRenderedVersion ¶ added in v0.9.0
func GetSSHPrivateKey ¶
GetSSHPrivateKey returns the SSH private key content. It first tries to get the key from the Kubernetes Secret (for OpenShift deployments), then falls back to the local bin/.ssh/id_rsa file (for local development).
func GetSSHPrivateKeyPath ¶
GetSSHPrivateKeyPath returns the path to the SSH private key file.
func GetSSHPublicKeyPath ¶
GetSSHPublicKeyPath returns the path to the SSH public key file.
func GetTestDataPath ¶
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
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 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 IsDeviceUpdateObserved ¶ added in v1.0.0
IsDeviceUpdateObserved returns true if the device is updating or has already updated to the expected version.
func NewContainerApplicationSpec ¶
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
func NewImageBuildSpec ¶
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 ¶
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 ¶
func NewImageExportSpec(imageBuildName string, format imagebuilderapi.ExportFormatType) imagebuilderapi.ImageExportSpec
NewImageExportSpec creates a new ImageExportSpec from an ImageBuild reference.
func NewMountVolume ¶
func NewMountVolume(name, mountPath string) (v1beta1.ApplicationVolume, error)
NewMountVolume creates a named volume mount for container apps
func RemoveSystemdService ¶ added in v1.0.0
RemoveSystemdService disables and removes a systemd unit file on the device and reloads systemd.
func RemoveVMFromPool ¶ added in v0.10.0
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 SetupVMForWorker ¶ added in v0.10.0
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 TestResourceOperations ¶
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 ¶
func UpdateDeviceApplicationFromInline(device *v1beta1.Device, appName string, inlineApp v1beta1.InlineApplicationProviderSpec) error
UpdateDeviceApplicationFromInline updates or appends an inline application spec on the device.
func WriteEvidence ¶
Types ¶
type APIError ¶
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) IsStatusCode ¶
IsStatusCode returns true if the error has the given HTTP status code.
type ConsoleSession ¶ added in v0.9.0
type ConsoleSession struct {
Stdin io.WriteCloser
Stdout *Buffer
}
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
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
type GitServerConfig ¶ added in v0.10.0
GitServerConfig holds configuration for the git server
type Harness ¶
type Harness struct {
Client *apiclient.ClientWithResponses
ImageBuilderClient *imagebuilderclient.ClientWithResponses
Context context.Context
Cluster kubernetes.Interface
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 NewTestHarnessWithVMPool ¶ added in v0.10.0
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
NewTestHarnessWithoutVM creates a new test harness without VM management.
func SetupWorkerHarness ¶ added in v0.10.0
SetupWorkerHarness sets up a VM and harness for the current worker. This should be called in BeforeSuite.
func SetupWorkerHarnessWithoutVM ¶
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
TODO: Modify addTestLabelsToYAML to include other labels and remove addLabelsToYAML
func (*Harness) ApiEndpoint ¶
func (*Harness) ApplyResource ¶ added in v0.10.0
func (*Harness) ApplyTempIfSuggested ¶ added in v1.0.0
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) CLIWithEnvAndShell ¶ added in v0.10.0
CLIWithEnvAndShell runs a shell command with custom environment variables (for complex commands with pipes)
func (*Harness) CLIWithStdin ¶
func (*Harness) CancelImageBuild ¶
CancelImageBuild cancels an in-progress ImageBuild.
func (*Harness) CancelImageExport ¶
CancelImageExport cancels an in-progress ImageExport.
func (*Harness) CaptureHostCLI ¶
CaptureHostCLI runs flightctl on the host and writes evidence.
func (*Harness) CaptureStandardEvidence ¶
CaptureStandardEvidence records common evidence files for pruning scenarios.
func (*Harness) CaptureVMCommand ¶
CaptureVMCommand runs a VM command and writes evidence.
func (*Harness) ChangeK8sContext ¶ added in v0.10.0
ChangeK8sContext changes the kubernetes context
func (*Harness) ChangeK8sNamespace ¶
ChangeK8sNamespace changes the current Kubernetes namespace
func (*Harness) CheckApplicationComposeFileExist ¶ added in v0.8.0
func (*Harness) CheckApplicationDirectoryExist ¶ added in v0.8.0
func (Harness) CheckApplicationStatus ¶ added in v0.8.0
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 (*Harness) CheckRunningContainers ¶ added in v0.7.0
CheckRunningContainers verifies the expected number of running containers on the VM.
func (*Harness) CleanUpAllTestResources ¶ added in v0.10.0
func (*Harness) CleanUpResource ¶ added in v0.10.0
func (*Harness) CleanUpTestResources ¶ added in v0.10.0
CleanUpTestResources deletes only resources that have the test label for the current test
func (*Harness) Cleanup ¶
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) CleanupClusterRoles ¶ added in v0.10.0
func (*Harness) CleanupGitRepositories ¶ added in v0.10.0
CleanupGitRepositories removes all git repositories created by the harness
func (*Harness) CleanupRoles ¶ added in v0.10.0
func (*Harness) CloneGitRepositoryFromServer ¶ added in v0.10.0
CloneGitRepositoryFromServer clones a repository from the git server to a local working directory
func (*Harness) CommitAndPushGitRepo ¶
CommitAndPushGitRepo commits all changes in a local git working directory and pushes to the remote. This uses `git add -A` to stage all changes (additions, modifications, deletions), then commits and pushes. The workDir must be a cloned git repository. This method mirrors real git workflows where you manipulate files locally then push.
func (*Harness) CreateCloudInitDir ¶
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) CreateClusterRole ¶ added in v0.10.0
func (h *Harness) CreateClusterRole(ctx context.Context, kubernetesClient kubernetes.Interface, clusterRole *rbacv1.ClusterRole) (*rbacv1.ClusterRole, error)
func (*Harness) CreateClusterRoleBinding ¶ added in v0.10.0
func (h *Harness) CreateClusterRoleBinding(ctx context.Context, kubernetesClient kubernetes.Interface, clusterRoleBinding *rbacv1.ClusterRoleBinding) (*rbacv1.ClusterRoleBinding, error)
func (*Harness) CreateDeviceConfigInGitRepo ¶ added in v0.10.0
func (h *Harness) CreateDeviceConfigInGitRepo(repoName, deviceName string, deviceSpec v1beta1.DeviceSpec) error
CreateDeviceConfigInGitRepo creates a device configuration and pushes it to a git repository
func (*Harness) CreateFleetConfigInGitRepo ¶ added in v0.10.0
func (h *Harness) CreateFleetConfigInGitRepo(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(deviceImageTag string, additionalConfigs ...v1beta1.ConfigProviderSpec) (v1beta1.DeviceSpec, error)
func (*Harness) CreateGitRepository ¶ added in v0.10.0
func (h *Harness) CreateGitRepository(repoName string, repositorySpec domain.RepositorySpec) error
CreateRepository creates a Repository resource pointing to the git server repository
func (*Harness) CreateGitRepositoryNoAuth ¶
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
CreateGitRepositoryOnServer creates a new Git repository on the e2e git server
func (*Harness) CreateGitRepositoryWithContent ¶ added in v0.10.0
func (h *Harness) CreateGitRepositoryWithContent(repoName, filePath, content string, repositorySpec v1beta1.RepositorySpec) error
CreateGitRepositoryWithContent creates a git repository with initial content
func (*Harness) CreateHTTPRepository ¶
func (h *Harness) CreateHTTPRepository(name, url string, username, password *string) (*v1beta1.Repository, error)
CreateHTTPRepository creates an HTTP repository.
func (*Harness) CreateImageBuild ¶
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 ¶
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 ¶
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 ¶
CreateRepositoryWithSSHCredentials creates a Repository resource with SSH credentials
func (*Harness) CreateRepositoryWithValidE2ECredentials ¶
CreateRepositoryWithValidE2ECredentials creates a Repository resource using the E2E SSH key and the internal cluster URL for the git server.
func (*Harness) CreateResource ¶ added in v0.10.0
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 ¶
func (*Harness) CreateRole ¶ added in v0.10.0
func (*Harness) CreateRoleBinding ¶ added in v0.10.0
func (h *Harness) CreateRoleBinding(ctx context.Context, kubernetesClient kubernetes.Interface, flightCtlNs string, roleBinding *rbacv1.RoleBinding) (*rbacv1.RoleBinding, error)
func (*Harness) CreateTestFleetWithConfig ¶ added in v0.6.0
func (h *Harness) CreateTestFleetWithConfig(testFleetName string, testFleetSelector v1beta1.LabelSelector, configProviderSpec v1beta1.ConfigProviderSpec) error
Create a test fleet with a configuration
func (*Harness) DeleteClusterRole ¶ added in v0.10.0
func (*Harness) DeleteClusterRoleBinding ¶ added in v0.10.0
func (*Harness) DeleteFleet ¶ added in v0.9.0
func (*Harness) DeleteGitRepositoryOnServer ¶ added in v0.10.0
DeleteGitRepositoryOnServer deletes a Git repository from the e2e git server
func (*Harness) DeleteImageBuild ¶
DeleteImageBuild deletes an ImageBuild resource by name.
func (*Harness) DeleteImageExport ¶
DeleteImageExport deletes an ImageExport resource by name.
func (*Harness) DeleteRepository ¶ added in v0.9.0
DeleteRepository deletes the specified repository
func (*Harness) DeleteResourceSync ¶ added in v0.10.0
DeleteResourceSync deletes the specified ResourceSync
func (*Harness) DeleteRole ¶ added in v0.10.0
func (*Harness) DeleteRoleBinding ¶ added in v0.10.0
func (*Harness) DownloadImageExport ¶
DownloadImageExport downloads an ImageExport artifact and returns the response body. The caller is responsible for closing the returned io.ReadCloser.
func (*Harness) DropinCleanupFunc ¶
DropinCleanupFunc returns a cleanup func that removes a drop-in and records evidence.
func (*Harness) EditWithRetry ¶ added in v1.0.0
EditWithRetry runs: flightctl edit -o <format> --editor <editor> <resource> Retries briefly if the server responds with a Conflict (resourceVersion race).
func (*Harness) EnableTPMForDevice ¶ added in v0.10.0
EnableTPMForDevice configures the agent to use TPM for device identity. This reads existing agent config, updates TPM settings, and writes it back.
func (*Harness) EnrollAndWaitForOnlineStatus ¶ added in v0.4.0
func (*Harness) EnsureArtifactDir ¶
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 ¶
EnsureDeviceSimulatorBinary returns the path to the devicesimulator binary, building it if missing.
func (*Harness) ExtractSingleContainerNameFromVM ¶
func (*Harness) FetchMetrics ¶
FetchMetrics fetches a Prometheus text metrics endpoint.
func (*Harness) FixNetworkFailure ¶ added in v0.8.1
func (*Harness) FixNetworkFailureForCLI ¶ added in v0.8.1
FixNetworkFailureForCLI removes an entry from iptables if it exists. returns an error if no entry for the ip:port combo exists
func (*Harness) FleetExists ¶
func (*Harness) GenerateEnrollmentConfig ¶
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 ¶
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) GetAgentVersion ¶ added in v0.10.0
GetAgentVersion returns the agent version from the flightctl-agent version command
func (*Harness) GetAgentVersionFromLogs ¶ added in v0.10.0
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) GetConfigMapValue ¶
GetConfigMapValue returns a string value from a ConfigMap using a jsonpath selector.
func (*Harness) GetContainerPorts ¶
GetContainerPorts returns the port mappings for running containers
func (*Harness) GetCurrentDeviceGeneration ¶ added in v0.6.0
func (*Harness) GetCurrentDeviceRenderedVersion ¶ added in v0.4.0
func (*Harness) GetDefaultK8sContext ¶ added in v0.10.0
GetDefaultK8sContext returns the a K8s context with default in its name
func (*Harness) GetDeviceByYaml ¶ added in v0.4.0
Wrapper function for Device
func (*Harness) GetDeviceFromTestContext ¶ added in v0.10.0
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) 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
Get an http config of a device resource
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) 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) GetEnrollmentIDFromServiceLogs ¶ added in v0.10.0
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) GetFleetByYaml ¶ added in v0.4.0
Wrapper function for Fleet
func (*Harness) GetFlightctlAgentLogs ¶ added in v0.10.0
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) GetFlightctlPath ¶ added in v0.10.0
GetFlightctlPath returns the path to the flightctl binary
func (*Harness) GetFreeLocalPort ¶
GetFreeLocalPort returns an available local TCP port.
func (*Harness) GetGitRepoURL ¶ added in v0.10.0
GetGitRepoURL returns the SSH URL for a git repository on the server
func (*Harness) GetGitServerConfig ¶ added in v0.10.0
func (h *Harness) GetGitServerConfig() (GitServerConfig, error)
GetGitServerConfig returns the configuration for the e2e git server. In KIND environments, it uses localhost:3222 (via port mappings). In OCP environments, it dynamically discovers the node IP and NodePort.
func (*Harness) GetImageBuild ¶
func (h *Harness) GetImageBuild(name string) (*imagebuilderapi.ImageBuild, error)
GetImageBuild retrieves an ImageBuild resource by name.
func (*Harness) GetImageBuildConditionReason ¶
GetImageBuildConditionReason returns the current condition reason for an ImageBuild.
func (*Harness) GetImageBuildConditionReasonAndMessage ¶
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 ¶
GetImageBuildLogs retrieves the logs for an ImageBuild.
func (*Harness) GetImageExport ¶
func (h *Harness) GetImageExport(name string) (*imagebuilderapi.ImageExport, error)
GetImageExport retrieves an ImageExport resource by name.
func (*Harness) GetImageExportConditionReason ¶
GetImageExportConditionReason returns the current condition reason for an ImageExport.
func (*Harness) GetImageExportLogs ¶
GetImageExportLogs retrieves the logs for an ImageExport.
func (*Harness) GetInternalGitRepoURL ¶
GetInternalGitRepoURL returns the internal cluster URL for a git repository on the E2E git server. This URL is used by services running inside the cluster (e.g., ResourceSync periodic task).
func (*Harness) GetK8sApiEndpoint ¶ added in v0.10.0
GetK8sApiEndpoint returns the API endpoint for a given K8s context
func (*Harness) GetMaxConcurrentBuilds ¶
GetMaxConcurrentBuilds reads the current maxConcurrentBuilds value from the worker configmap.
func (*Harness) GetOrganizationID ¶
GetOrganizationID returns the first organization ID from the API.
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 ¶
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 ¶
func (*Harness) GetResourcesByName ¶ added in v0.8.1
Wrapper function for Shell command to get resources by name
func (*Harness) GetRolloutStatus ¶ added in v0.8.1
func (*Harness) GetSelectedDevicesForBatch ¶ added in v0.8.1
func (*Harness) GetServiceLogs ¶ added in v0.10.0
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) GetTestContext ¶ added in v0.10.0
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
GetTestDataFromContext retrieves arbitrary test data from the context using a string key
func (*Harness) GetTestIDFromContext ¶ added in v0.10.0
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 (*Harness) GetUpdatedDevices ¶ added in v0.8.1
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) GetYAML ¶ added in v1.0.0
GetYAML returns the YAML output of a given resource name via Harness.CLI. No test framework calls inside; returns (string, error).
func (*Harness) HeadlessEditorWrapper ¶ added in v1.0.0
func (*Harness) ImageBuildExists ¶
ImageBuildExists checks if an ImageBuild resource exists.
func (*Harness) ImageExportExists ¶
ImageExportExists checks if an ImageExport resource exists.
func (*Harness) IsRepositoryAccessible ¶
IsRepositoryAccessible checks if a repository has its Accessible condition set to True.
func (*Harness) KillImageBuilderWorkerPods ¶
KillImageBuilderWorkerPods kills all imagebuilder-worker pods. This is used to test recovery scenarios.
func (*Harness) ListImageBuilds ¶
func (h *Harness) ListImageBuilds(params *imagebuilderapi.ListImageBuildsParams) (*imagebuilderapi.ImageBuildList, error)
ListImageBuilds lists all ImageBuild resources.
func (*Harness) ListImageExports ¶
func (h *Harness) ListImageExports(params *imagebuilderapi.ListImageExportsParams) (*imagebuilderapi.ImageExportList, error)
ListImageExports lists all ImageExport resources.
func (*Harness) ListRepositories ¶
func (h *Harness) ListRepositories() (*v1beta1.RepositoryList, error)
ListRepositories lists all repositories.
func (*Harness) ManageResource ¶ added in v0.7.0
ManageResource performs an operation ("apply", "delete", "approve" or "deny") on a specified resource.
func (*Harness) MarkClientAccessTokenExpired ¶ added in v0.8.1
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 ¶
MetricsBody returns a closure to fetch metrics for Eventually.
func (*Harness) MetricsLineCount ¶
MetricsLineCount returns a closure to count lines in a metrics payload.
func (*Harness) MetricsMatchLabels ¶
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) 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 ¶
OTelcolActiveStatus returns a closure for Eventually to check otelcol status.
func (*Harness) PrepareNextDeviceGeneration ¶ added in v0.6.0
func (*Harness) PrepareNextDeviceVersion ¶ added in v0.4.0
func (*Harness) PrintAgentLogsIfFailed ¶
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 ¶
func (h *Harness) PromQuery(baseURL, query string) (PromQueryResponse, error)
PromQuery executes a Prometheus query against a base URL.
func (*Harness) PromQueryCountValue ¶
PromQueryCountValue returns a closure for polling a count() query value.
func (*Harness) PromQueryHasLabels ¶
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 ¶
PromQueryResultCount returns a closure for polling the count of query results.
func (*Harness) PushContentToGitServerRepo ¶ added in v0.10.0
func (h *Harness) PushContentToGitServerRepo(repoName, filePath, content, commitMessage string) error
PushContentToGitServerRepo pushes content to a git repository on the server
func (*Harness) PushContentToGitServerRepoFromPath ¶
func (h *Harness) PushContentToGitServerRepoFromPath(repoName, sourcePath, commitMessage string) error
PushContentToGitServerRepoFromPath reads content from a local file or directory and pushes it to a git repository on the server. If sourcePath is a directory, all files within it are copied to the repository root. If sourcePath is a file, it is copied to the repository with its base name.
func (*Harness) PushTemplatedFilesToGitRepo ¶
func (h *Harness) PushTemplatedFilesToGitRepo(repoName, sourceDir, workDir string, data interface{}) error
PushTemplatedFilesToGitRepo updates an existing git repo with templated files, commits and pushes
func (*Harness) QuadletImageAppSpec ¶
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) ReadClientConfig ¶ added in v0.8.1
ReadClientConfig returns the client config for at the specified location. The default config path is used if no path is specified
func (*Harness) ReadPrimaryVMAgentLogs ¶ added in v0.9.0
ReadPrimaryVMAgentLogs reads flightctl-agent journalctl logs from the primary VM
func (*Harness) RebootVMAndWaitForSSH ¶
RebootVMAndWaitForSSH triggers a reboot on the VM and waits for SSH to become ready again.
func (*Harness) RefreshClient ¶
RefreshClient recreates the FlightCtl API 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) RegistryEndpoint ¶ added in v0.4.0
func (*Harness) ReloadFlightCtlAgent ¶ added in v0.10.0
ReloadFlightCtlAgent reloads the flightctl-agent service
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 (*Harness) ResolveImage ¶
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) RestartFlightCtlAgent ¶ added in v0.10.0
RestartFlightCtlAgent restarts the flightctl-agent service
func (*Harness) RunConsoleCommand ¶ added in v0.9.0
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 ¶
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
RunGetDevices executes "get devices" CLI command with optional arguments.
func (*Harness) RunGetEvents ¶ added in v0.8.1
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 ¶
RunPodmanPsContainerNames runs podman ps (or podman ps -a) on the VM and returns container names.
func (*Harness) RunVMCommandWithEvidence ¶
RunVMCommandWithEvidence runs a VM command and captures its output.
func (*Harness) SHWithStdin ¶ added in v0.3.0
func (*Harness) SetAgentConfig ¶ added in v0.10.0
SetAgentConfig configures the agent by writing the configuration file. This method should be called before starting the agent.
func (*Harness) SetDeviceApplications ¶
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 (*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 (*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) SetMaxConcurrentBuilds ¶
SetMaxConcurrentBuilds updates the maxConcurrentBuilds setting in the worker config and restarts the worker pods to apply the change.
func (*Harness) SetTestContext ¶ added in v0.10.0
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 ¶
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) SetupDeviceWithTPM ¶ added in v0.10.0
SetupDeviceWithTPM prepares a device VM with TPM functionality enabled. This handles the complete TPM setup process in the correct order.
func (*Harness) SetupScenario ¶
SetupScenario creates the artifacts dir for the scenario.
func (*Harness) SetupTemplatedGitRepoFromDir ¶
func (h *Harness) SetupTemplatedGitRepoFromDir(repoName, sourceDir string, data interface{}) (string, error)
SetupTemplatedGitRepoFromDir creates a git repo, clones it, populates with templated files, and pushes
func (*Harness) SetupVMFromPool ¶
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
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) SimulateNetworkFailure ¶ added in v0.8.1
func (*Harness) SimulateNetworkFailureForCLI ¶ added in v0.8.1
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) StartFlightCtlAgent ¶ added in v0.10.0
StartFlightCtlAgent starts the flightctl-agent service
func (*Harness) StartPortForward ¶
func (h *Harness) StartPortForward(ctx context.Context, namespace, target string, localPort, remotePort int) (*exec.Cmd, <-chan error, error)
StartPortForward starts a kubectl port-forward for a service or pod.
func (*Harness) StartPortForwardWithCleanup ¶
func (h *Harness) StartPortForwardWithCleanup(namespace, target string, localPort, remotePort int) (func(), error)
StartPortForwardWithCleanup starts port-forwarding and returns a cleanup function.
func (*Harness) StartVMAndEnroll ¶
func (*Harness) StopDeviceSimulator ¶
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
StopFlightCtlAgent stops the flightctl-agent service
func (*Harness) StoreDeviceInTestContext ¶ added in v0.10.0
StoreDeviceInTestContext stores device data in the test context for use within the same test
func (*Harness) StoreTestDataInContext ¶ added in v0.10.0
StoreTestDataInContext stores arbitrary test data in the context using a string key
func (*Harness) StreamImageBuildLogsWithTimeout ¶
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 ¶
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) TestEnrollmentApproval ¶ added in v0.10.0
func (h *Harness) TestEnrollmentApproval(labels ...map[string]string) *v1beta1.EnrollmentRequestApproval
func (*Harness) UpdateApplication ¶ added in v0.8.0
func (*Harness) UpdateClusterRole ¶ added in v0.10.0
func (h *Harness) UpdateClusterRole(ctx context.Context, kubernetesClient kubernetes.Interface, clusterRole *rbacv1.ClusterRole) (*rbacv1.ClusterRole, error)
func (*Harness) UpdateDevice ¶ added in v0.6.0
func (*Harness) UpdateDeviceAndWait ¶
func (*Harness) UpdateDeviceAndWaitForRenderedVersion ¶
func (h *Harness) UpdateDeviceAndWaitForRenderedVersion(deviceID string, updateFunc func(*v1beta1.Device)) error
UpdateDeviceAndWaitForRenderedVersion updates the device with the given function and waits for the new rendered version.
func (*Harness) UpdateDeviceAndWaitForVersion ¶
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) UpdateDeviceWithQuadletInline ¶
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 ¶
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) UpdateDeviceWithRetries ¶ added in v0.3.0
func (*Harness) UpdateFleet ¶ added in v0.9.0
func (*Harness) UpdateFleetWithRetries ¶ added in v0.9.0
func (*Harness) UpdateGitServerRepository ¶ added in v0.10.0
func (h *Harness) UpdateGitServerRepository(repoName, filePath, content, commitMessage string) error
UpdateGitServerRepository updates content in an existing git repository working directory
func (*Harness) UpdateImageBuilderWorkerConfig ¶
UpdateImageBuilderWorkerConfig updates the imagebuilder-worker config using the provided modifier function and restarts the worker pods to apply the change.
func (*Harness) UpdateOCIRepositoryRegistry ¶
UpdateOCIRepositoryRegistry updates an OCI repository's registry URL.
func (*Harness) UpdateRole ¶ added in v0.10.0
func (*Harness) UpdateSystemdMatchPatterns ¶ added in v1.0.0
UpdateSystemdMatchPatterns applies the given match patterns to device.spec.systemd.
func (*Harness) VMCommandOutputFunc ¶
VMCommandOutputFunc returns a polling function for Eventually/Consistently.
func (*Harness) ValidateFleetYAMLDevicesPerFleet ¶
func (*Harness) VerifyCommandLacksSubstring ¶
func (*Harness) VerifyCommandOutputsSubstring ¶
func (*Harness) VerifyContainerCount ¶
func (*Harness) VerifyContainerRunning ¶
VerifyContainerRunning checks that podman shows containers running with the given image substring
func (*Harness) VerifyDeviceTPMAttestationData ¶ added in v0.10.0
VerifyDeviceTPMAttestationData checks for TPM attestation data in device SystemInfo Virtual TPM provides "tpmVendorInfo", real TPM provides "attestation" Returns error if attestation data is missing or empty
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 Returns error if no TPM attestation data is found
func (*Harness) VerifyQuadletApplicationFolderDeleted ¶
VerifyQuadletApplicationFolderDeleted checks that the application folder was removed
func (*Harness) VerifyQuadletApplicationFolderExists ¶
VerifyQuadletApplicationFolderExists checks that the application folder exists
func (*Harness) VerifyQuadletPodmanArgs ¶
VerifyQuadletPodmanArgs verifies that a quadlet file contains the expected PodmanArgs entry
func (*Harness) VerifyServiceExists ¶
VerifyServiceExists verifies a Kubernetes service exists.
func (*Harness) VerifyTPMFunctionality ¶ added in v0.10.0
VerifyTPMFunctionality checks that TPM device is accessible and functional.
func (*Harness) WaitForApplicationRunningStatus ¶
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 ¶
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 ¶
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) WaitForApplicationSummaryDegradedOrError ¶
func (h *Harness) WaitForApplicationSummaryDegradedOrError(deviceID string, timeout, polling time.Duration) error
WaitForApplicationSummaryDegradedOrError polls until the device's applications summary is Degraded or Error, or timeout.
func (*Harness) WaitForApplicationsCount ¶
WaitForApplicationsCount waits for the total number of applications to match the expected count
func (*Harness) WaitForApplicationsSummaryNotHealthy ¶
WaitForApplicationsSummaryNotHealthy waits until applications summary status is set and not Healthy.
func (*Harness) WaitForApplicationsSummaryStatus ¶
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 (*Harness) WaitForBootstrapAndUpdateToVersion ¶ added in v0.4.0
func (*Harness) WaitForClusterRegistered ¶ added in v0.8.1
func (*Harness) WaitForDeviceContents ¶ added in v0.3.0
func (*Harness) WaitForDeviceNewGeneration ¶ added in v0.6.0
func (*Harness) WaitForDeviceNewRenderedVersion ¶ added in v0.4.0
func (*Harness) WaitForDeviceNewRenderedVersionWithReboot ¶
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) WaitForEnrollmentRequest ¶
func (h *Harness) WaitForEnrollmentRequest(id string) *v1beta1.EnrollmentRequest
func (*Harness) WaitForFileInDevice ¶ added in v0.8.1
func (*Harness) WaitForFleetContents ¶ added in v0.9.0
func (*Harness) WaitForFleetCount ¶
func (*Harness) WaitForFleetUpdateToFail ¶ added in v0.8.1
func (*Harness) WaitForImageBuildCompletion ¶
func (h *Harness) WaitForImageBuildCompletion(name string, timeout time.Duration) (*imagebuilderapi.ImageBuild, error)
WaitForImageBuildCompletion waits for an ImageBuild to complete successfully.
func (*Harness) WaitForImageBuildCondition ¶
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 ¶
func (h *Harness) WaitForImageBuildFailure(name string, timeout time.Duration) (*imagebuilderapi.ImageBuild, error)
WaitForImageBuildFailure waits for an ImageBuild to fail.
func (*Harness) WaitForImageBuildProcessing ¶
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, Failed, or other non-Pending state.
func (*Harness) WaitForImageBuildWithLogs ¶
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) WaitForImageBuilderWorkerReady ¶
WaitForImageBuilderWorkerReady waits for the imagebuilder-worker pods to be ready.
func (*Harness) WaitForImageExportProcessing ¶
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 ¶
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) WaitForNoApplications ¶
WaitForNoApplications waits for the device to have no applications in status
func (*Harness) WaitForPodmanImagePresence ¶
WaitForPodmanImagePresence waits until a podman image is present/absent on the VM.
func (*Harness) WaitForRepositoryAccessible ¶
WaitForRepositoryAccessible waits for a repository to have its Accessible condition set to True.
func (*Harness) WaitForRepositoryNotAccessible ¶
WaitForRepositoryNotAccessible waits for a repository to have its Accessible condition set to False.
func (*Harness) WaitForResourceSyncCondition ¶
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 ¶
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) WaitForTPMInitialization ¶ added in v0.10.0
WaitForTPMInitialization waits for TPM hardware to be ready in the VM. This should be called after VM setup but before agent configuration.
type InlineContent ¶
type PromQueryResponse ¶
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 ResourceTestConfig ¶
ResourceTestConfig represents a test configuration for resource operations with different success expectations per resource group
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
CleanupAll cleans up all VMs in the pool
func (*VMPool) CleanupWorkerVM ¶ added in v0.10.0
CleanupWorkerVM cleans up the VM for a specific worker
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
VMPoolConfig holds configuration for the VM pool
Source Files
¶
- harness.go
- harness_agent.go
- harness_application.go
- harness_applications.go
- harness_console.go
- harness_device.go
- harness_devicesim.go
- harness_errors.go
- harness_fleet.go
- harness_git.go
- harness_imagebuild.go
- harness_observability.go
- harness_oc.go
- harness_rbac.go
- harness_repository.go
- harness_resourcesync.go
- harness_systemd.go
- vm_pool.go
- worker_utils.go