events

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package events provides Terratest-style helpers for testing Argo Events resources, including EventSources and Sensors. These helpers use client-go polling to wait for resources to report a Ready condition, ensuring event-driven workflows are correctly configured.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasReadyCondition

func HasReadyCondition(conds []metav1.Condition, expectedType string) bool

HasReadyCondition checks if the provided slice of metav1.Condition contains a condition of the specified type with a status of "True". It returns true if such a condition is found, otherwise returns false.

conds: Slice of metav1.Condition to search through. expectedType: The condition type to look for.

Returns true if a condition with the expected type and a status of "True" exists, false otherwise.

func ListEventBuses added in v0.0.5

func ListEventBuses(t *testing.T, options *k8s.KubectlOptions, namespace string) []argoeventsv1alpha1.EventBus

ListEventBuses retrieves a list of Argo EventBus resources in the specified namespace. It uses the provided testing context and kubectl options to create an Argo Events client, then lists all EventBus objects in the given namespace. The function fails the test if the client cannot be created or if the EventBus list operation fails.

Parameters:

  • t: The testing context.
  • options: The kubectl options used to configure the client.
  • namespace: The Kubernetes namespace from which to list EventBus resources.

Returns:

  • A slice of argoeventsv1alpha1.EventBus objects found in the specified namespace.

func ListEventSources added in v0.0.5

func ListEventSources(t *testing.T, options *k8s.KubectlOptions, namespace string) []argoeventsv1alpha1.EventSource

ListEventSources retrieves a list of Argo EventSource resources from the specified namespace. It uses the provided testing context and kubectl options to create an Argo Events client, then lists all EventSources in the given namespace. The function fails the test if any error occurs.

Parameters:

  • t: The testing context.
  • options: The kubectl options for connecting to the Kubernetes cluster.
  • namespace: The namespace from which to list EventSources.

Returns:

  • A slice of argoeventsv1alpha1.EventSource objects representing the EventSources in the namespace.

func ListSensors added in v0.0.5

func ListSensors(t *testing.T, options *k8s.KubectlOptions, namespace string) []argoeventsv1alpha1.Sensor

ListSensors retrieves a list of Argo Events Sensor resources from the specified namespace. It uses the provided testing context and kubectl options to create an Argo Events client, then lists all Sensor resources in the given namespace. The function fails the test if any error occurs during client creation or sensor listing.

Parameters:

  • t: The testing context.
  • options: The kubectl options used to configure the client.
  • namespace: The Kubernetes namespace from which to list the sensors.

Returns:

  • A slice of argoeventsv1alpha1.Sensor objects representing the sensors found in the namespace.

func NewArgoEventsClient added in v0.0.5

func NewArgoEventsClient(t *testing.T, options *k8s.KubectlOptions) (argoclientset.Interface, error)

NewArgoEventsClient creates a new Argo Events client using the provided testing context and Kubernetes options. It retrieves the Kubernetes REST configuration from the provided options or generates one if not present. Returns an Argo Events clientset interface and an error if the client could not be created.

Parameters:

  • t: The testing context, used for logging and error handling.
  • options: The Kubernetes KubectlOptions containing cluster access information.

Returns:

  • argoclientset.Interface: The Argo Events clientset interface for interacting with Argo Events resources.
  • error: An error if the client could not be created.

func WaitForEventBusReady

func WaitForEventBusReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)

WaitForEventBusReady waits until the specified Argo Events EventBus resource is Ready, or times out. Useful for integration tests to ensure event infrastructure is available before proceeding.

func WaitForEventSourceReady

func WaitForEventSourceReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)

WaitForEventSourceReady waits until the specified Argo Events EventSource resource is Ready, or times out. Useful for integration tests to ensure event sources are available before proceeding.

func WaitForSensorReady

func WaitForSensorReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)

WaitForSensorReady waits until the specified Argo Sensor resource in the given namespace becomes Ready. It polls the sensor's status conditions at regular intervals until the ConditionReady is True or the timeout is reached. If the sensor does not become Ready within the timeout, the test fails. Parameters:

  • t: The testing context.
  • options: Kubectl options containing the Kubernetes REST config.
  • name: The name of the Sensor resource.
  • namespace: The namespace where the Sensor is located.
  • timeout: The maximum duration to wait for the sensor to become Ready.

Types

This section is empty.

Jump to

Keyboard shortcuts

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