Documentation
¶
Overview ¶
Package flux provides Terratest-style helpers for testing Flux resources such as Kustomizations, HelmReleases, GitRepositories, and HelmRepositories. These functions wait for Flux CRDs to become Ready using status conditions and standard polling logic.
Index ¶
- func ListHelmReleases(t *testing.T, options *k8s.KubectlOptions, namespace string) []helmv2.HelmRelease
- func ListHelmRepositories(t *testing.T, options *k8s.KubectlOptions, namespace string) []sourcev1.HelmRepository
- func NewFluxClient(t *testing.T, options *k8s.KubectlOptions) (client.Client, error)
- func WaitForBucketReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, ...)
- func WaitForGitRepositoryReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, ...)
- func WaitForHelmChartReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, ...)
- func WaitForHelmReleaseReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, ...)
- func WaitForHelmRepositoryReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, ...)
- func WaitForKustomizationReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, ...)
- func WaitForOCIRepositoryReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListHelmReleases ¶ added in v0.0.5
func ListHelmReleases(t *testing.T, options *k8s.KubectlOptions, namespace string) []helmv2.HelmRelease
func ListHelmRepositories ¶ added in v0.0.5
func ListHelmRepositories(t *testing.T, options *k8s.KubectlOptions, namespace string) []sourcev1.HelmRepository
func NewFluxClient ¶
NewFluxClient creates a new controller-runtime client for Flux resources using the provided Kubernetes REST config.
func WaitForBucketReady ¶
func WaitForBucketReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)
WaitForBucketReady waits until the specified Flux Bucket resource reaches the "Ready" condition within the given timeout. It polls the Kubernetes API at regular intervals to check the Bucket's status. If the Bucket does not become ready within the timeout, the test fails. Parameters:
t - The testing context. options - Kubectl options containing the REST config for Kubernetes API access. name - The name of the Bucket resource. namespace- The namespace where the Bucket resource is located. timeout - The maximum duration to wait for the Bucket to become ready.
func WaitForGitRepositoryReady ¶
func WaitForGitRepositoryReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)
WaitForGitRepositoryReady waits until the specified Flux GitRepository resource becomes Ready within the given timeout. It polls the resource status every 2 seconds and fails the test if the resource does not become Ready in time.
Parameters:
t - The testing context. options - The kubectl options containing the REST config for the Kubernetes cluster. name - The name of the GitRepository resource. namespace- The namespace where the GitRepository resource is located. timeout - The maximum duration to wait for the resource to become Ready.
Fails the test if the GitRepository does not reach the Ready condition within the timeout.
func WaitForHelmChartReady ¶
func WaitForHelmChartReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)
WaitForHelmChartReady waits until the specified HelmChart resource in the given namespace becomes Ready within the provided timeout. It uses the Flux client to poll the HelmChart status and checks for the Ready condition. If the HelmChart does not become Ready within the timeout, the test fails with a fatal error.
Parameters:
t - The testing context. options - Kubectl options containing the Kubernetes REST config. name - The name of the HelmChart resource. namespace- The namespace where the HelmChart is deployed. timeout - The maximum duration to wait for the HelmChart to become Ready.
Fails the test if the HelmChart does not reach the Ready condition within the timeout.
func WaitForHelmReleaseReady ¶
func WaitForHelmReleaseReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)
WaitForHelmReleaseReady waits until the specified HelmRelease resource in the given namespace reaches the Ready condition or the timeout is exceeded. It polls the resource status at regular intervals and fails the test if the resource does not become Ready within the timeout period.
Parameters:
t - The testing context. options - The kubectl options containing the Kubernetes REST config. name - The name of the HelmRelease resource. namespace- The namespace where the HelmRelease is located. timeout - The maximum duration to wait for the HelmRelease to become Ready.
The function will call t.Fatalf if the HelmRelease does not become Ready within the timeout.
func WaitForHelmRepositoryReady ¶
func WaitForHelmRepositoryReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)
WaitForHelmRepositoryReady waits until the specified Flux HelmRepository resource becomes Ready within the given timeout. It polls the resource status every 2 seconds and fails the test if the resource does not become Ready in time. Parameters:
- t: The testing context.
- options: Kubectl options containing the Kubernetes REST config.
- name: The name of the HelmRepository resource.
- namespace: The namespace of the HelmRepository resource.
- timeout: The maximum duration to wait for the resource to become Ready.
Fails the test if the HelmRepository does not reach the Ready condition within the timeout.
func WaitForKustomizationReady ¶
func WaitForKustomizationReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)
WaitForKustomizationReady waits until the specified Flux Kustomization resource reaches the Ready condition within the given timeout. It polls the resource status at regular intervals and fails the test if the resource does not become Ready in time. Parameters:
- t: The testing context.
- options: Kubectl options containing the Kubernetes REST config.
- name: The name of the Kustomization resource.
- namespace: The namespace of the Kustomization resource.
- timeout: The maximum duration to wait for the resource to become Ready.
The function will fail the test if the Kustomization does not become Ready within the timeout.
func WaitForOCIRepositoryReady ¶
func WaitForOCIRepositoryReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)
WaitForOCIRepositoryReady waits until the specified Flux OCIRepository resource becomes Ready within the given timeout. It polls the resource status at regular intervals and fails the test if the resource does not become Ready in time.
Parameters:
t - The testing context. options - Kubectl options containing the REST config for the Kubernetes cluster. name - The name of the OCIRepository resource. namespace- The namespace where the OCIRepository resource is located. timeout - The maximum duration to wait for the resource to become Ready.
Fails the test if the OCIRepository does not reach the Ready condition within the timeout.
Types ¶
This section is empty.