Documentation
¶
Overview ¶
Package velero provides Terratest-style helpers for testing Velero backups, restores, and storage configurations. Helpers include wait functions for BackupStorageLocations, Backups, and Restores using status conditions and phases.
Index ¶
- func NewVeleroClient(cfg *rest.Config) (client.Client, error)
- func WaitForBackupStorageLocationReady(t *testing.T, options k8s.KubectlOptions, name, namespace string, ...)
- func WaitForBackupSucceeded(t *testing.T, options k8s.KubectlOptions, name, namespace string, ...)
- func WaitForRestoreCompleted(t *testing.T, options k8s.KubectlOptions, name, namespace string, ...)
- func WaitForScheduleToExist(t *testing.T, options k8s.KubectlOptions, name, namespace string, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewVeleroClient ¶
NewVeleroClient creates a new controller-runtime client for Velero resources using the provided Kubernetes REST config.
func WaitForBackupSucceeded ¶
func WaitForBackupSucceeded(t *testing.T, options k8s.KubectlOptions, name, namespace string, timeout time.Duration)
WaitForBackupSucceeded waits until the specified Velero backup reaches the "Completed" phase or the timeout is reached. It polls the backup status every 2 seconds and fails the test if the backup does not complete successfully within the given timeout.
Parameters:
- t: The testing context.
- options: The kubectl options containing the Kubernetes REST config.
- name: The name of the Velero backup to check.
- namespace: The namespace where the backup resides.
- timeout: The maximum duration to wait for the backup to complete.
This function will call t.Fatalf if the backup does not complete successfully within the timeout.
func WaitForRestoreCompleted ¶
func WaitForRestoreCompleted(t *testing.T, options k8s.KubectlOptions, name, namespace string, timeout time.Duration)
WaitForRestoreCompleted waits until a Velero Restore resource reaches the "Completed" phase or the specified timeout is reached. It polls the status of the Restore resource every 2 seconds. If the Restore does not reach the "Completed" phase within the timeout, the test fails with a fatal error. If the Restore resource is not found during polling, it logs a retry message and continues polling.
Parameters:
- t: The testing context.
- options: The kubectl options containing the Kubernetes REST config.
- name: The name of the Velero Restore resource.
- namespace: The namespace where the Restore resource is located.
- timeout: The maximum duration to wait for the Restore to complete.
func WaitForScheduleToExist ¶
func WaitForScheduleToExist(t *testing.T, options k8s.KubectlOptions, name, namespace string, timeout time.Duration)
WaitForScheduleToExist waits until a Velero Schedule resource with the specified name and namespace exists and is in the "Enabled" phase, or until the given timeout is reached. It polls the Kubernetes API at regular intervals and fails the test if the schedule does not become enabled within the timeout period.
Parameters:
- t: The testing context.
- options: The kubectl options containing the Kubernetes REST config.
- name: The name of the Velero Schedule resource to wait for.
- namespace: The namespace where the Velero Schedule resource is expected to exist.
- timeout: The maximum duration to wait for the schedule to become enabled.
This function logs retries and fails the test with a fatal error if the schedule does not become enabled in time.
Types ¶
This section is empty.