Documentation
¶
Overview ¶
Package cd provides Terratest-style helpers for testing Argo CD Applications and AppProjects. It includes functions to wait for Applications to become Synced and Healthy, as well as utilities to verify AppProject presence.
Index ¶
- func IsApplicationHealthyAndSynced(app *argocdv1alpha1.Application) bool
- func NewArgoCDClient(t *testing.T, options *k8s.KubectlOptions) (argocd.Interface, error)
- func WaitForAppProjectExists(t *testing.T, options *k8s.KubectlOptions, name, namespace string, ...)
- func WaitForApplicationHealthyAndSynced(t *testing.T, options *k8s.KubectlOptions, name, namespace string, ...)
- func WaitForApplicationSetHealthyAndSynced(t *testing.T, options *k8s.KubectlOptions, name, namespace string, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsApplicationHealthyAndSynced ¶
func IsApplicationHealthyAndSynced(app *argocdv1alpha1.Application) bool
IsApplicationHealthyAndSynced returns true if the given Argo CD application is both healthy and synced. It checks that the application's health status is 'Healthy' and its sync status is 'Synced'.
func NewArgoCDClient ¶ added in v0.0.5
func WaitForAppProjectExists ¶
func WaitForAppProjectExists(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)
WaitForAppProjectExists waits until an Argo CD AppProject with the specified name exists in the given namespace. It polls the Kubernetes API at regular intervals until the AppProject is found or the timeout is reached. If the AppProject does not appear within the timeout, the test fails. Parameters:
- t: The testing context.
- options: Kubectl options containing the REST config for the Kubernetes cluster.
- name: The name of the AppProject to wait for.
- namespace: The namespace in which to look for the AppProject.
- timeout: The maximum duration to wait for the AppProject to appear.
func WaitForApplicationHealthyAndSynced ¶
func WaitForApplicationHealthyAndSynced(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)
WaitForApplicationHealthyAndSynced waits until the specified Argo CD Application resource in the given namespace reaches both "Healthy" and "Synced" status within the provided timeout. It polls the Application status every 2 seconds using the Argo CD client and fails the test if the desired state is not achieved within the timeout period.
Parameters:
t - The testing context. options - Kubectl options containing the Kubernetes REST config. name - The name of the Argo CD Application. namespace- The namespace where the Application resides. timeout - The maximum duration to wait for the Application to become Healthy and Synced.
Fails the test if the Application does not reach the desired state within the timeout.
func WaitForApplicationSetHealthyAndSynced ¶
func WaitForApplicationSetHealthyAndSynced(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)
WaitForApplicationSetHealthyAndSynced waits until the specified Argo CD ApplicationSet in the given namespace is healthy and its resources are up to date, or until the provided timeout is reached. It polls the ApplicationSet status every 2 seconds, checking for the "ResourcesUpToDate" condition with a "True" status. If the ApplicationSet does not become healthy and synced within the timeout, the test fails. Parameters:
- t: The testing context.
- options: Kubectl options containing the Kubernetes REST config.
- name: The name of the ApplicationSet.
- namespace: The namespace where the ApplicationSet resides.
- timeout: The maximum duration to wait for the ApplicationSet to become healthy and synced.
Types ¶
This section is empty.