e2elib

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvoyGatewayNamespace is the namespace where the Envoy Gateway is installed.
	EnvoyGatewayNamespace = "envoy-gateway-system"
	// EnvoyGatewayDefaultServicePort is the default service port for the Envoy Gateway.
	EnvoyGatewayDefaultServicePort = 80
)

Variables

This section is empty.

Functions

func CleanupKindCluster added in v0.4.0

func CleanupKindCluster(testsFailed bool, clusterName string)

CleanupKindCluster cleans up the kind cluster if the test succeeds and the TEST_KEEP_CLUSTER environment variable is not set to "true".

Also, if the tests failed or TEST_KEEP_CLUSTER is "true", it collects the kind logs into the ./logs directory.

func InstallOrUpgradeAIGateway added in v0.4.0

func InstallOrUpgradeAIGateway(ctx context.Context, aigw AIGatewayHelmOption) (err error)

InstallOrUpgradeAIGateway installs or upgrades the AI Gateway using Helm.

func Kubectl

func Kubectl(ctx context.Context, args ...string) *exec.Cmd

Kubectl runs the kubectl command with the given context and arguments.

func KubectlApplyManifest

func KubectlApplyManifest(ctx context.Context, manifest string) (err error)

func KubectlApplyManifestStdin

func KubectlApplyManifestStdin(ctx context.Context, manifest string) (err error)

KubectlApplyManifestStdin applies the given manifest using kubectl, reading from stdin.

func KubectlDeleteManifest

func KubectlDeleteManifest(ctx context.Context, manifest string) (err error)

KubectlDeleteManifest deletes the given manifest using kubectl.

func KubectlRestartDeployment added in v0.4.0

func KubectlRestartDeployment(ctx context.Context, namespace, deployment string) error

func RequireGatewayListenerAddressViaMetalLB added in v0.4.0

func RequireGatewayListenerAddressViaMetalLB(t *testing.T, namespace, name string) (addr string)

RequireGatewayListenerAddressViaMetalLB gets the external IP address of the Gateway via MetalLB.

func RequireWaitForGatewayPodReady

func RequireWaitForGatewayPodReady(t *testing.T, selector string)

RequireWaitForGatewayPodReady waits for the Envoy Gateway pod with the given selector to be ready.

func RequireWaitForPodReady

func RequireWaitForPodReady(t *testing.T, namespace, selector string)

RequireWaitForPodReady waits for the pod with the given selector to be ready.

func SetupAll added in v0.4.0

func SetupAll(ctx context.Context, clusterName string, aigwOpts AIGatewayHelmOption, inferenceExtension, needPrometheus bool) error

SetupAll sets up the kind cluster, installs the Envoy Gateway, and installs the AI Gateway.

func TestMain

func TestMain(m *testing.M, aigwOpts AIGatewayHelmOption, inferenceExtension, needPrometheus bool)

TestMain is the entry point for the e2e tests. It sets up the kind cluster, installs the Envoy Gateway, and installs the AI Gateway. It can be called with additional flags for the AI Gateway Helm chart.

When the inferenceExtension flag is set to true, it also installs the Inference Extension and the Inference Pool resources, and the Envoy Gateway configuration which are required for the tests.

Types

type AIGatewayHelmOption added in v0.4.0

type AIGatewayHelmOption struct {
	// ChartVersion is the version of the AI Gateway Helm chart to install. If empty, the locally built chart is used.
	// Otherwise, it should be a valid semver version string and the chart will be pulled from the Docker Hub OCI registry.
	//
	// For example, giving "v0.3.0" here will result in install oci://docker.io/envoyproxy/ai-gateway-helm --version v0.3.0.
	ChartVersion string
	// AdditionalArgs are additional arguments to pass to the Helm install/upgrade command.
	AdditionalArgs []string
	// Namespace where the AI Gateway will be installed. Default is "envoy-ai-gateway-system".
	Namespace string
}

AIGatewayHelmOption contains options for installing the AI Gateway Helm chart.

func (*AIGatewayHelmOption) GetNamespace added in v0.4.0

func (a *AIGatewayHelmOption) GetNamespace() string

type PortForwarder

type PortForwarder interface {
	// Post sends an HTTP POST request and returns the response body.
	// Automatically retries on stale connections during serviceURL rollouts.
	Post(ctx context.Context, path, body string) ([]byte, error)
	// Kill terminates the port-forward process.
	Kill()
	// Address returns the local address (e.g., "http://127.0.0.1:12345").
	Address() string
}

PortForwarder provides HTTP access to services in a Kubernetes cluster via kubectl port-forward. Thread-safe for concurrent use. Automatically recovers from connection failures during pod rolling updates.

func RequireNewHTTPPortForwarder

func RequireNewHTTPPortForwarder(t *testing.T, namespace string, selector string, servicePort int) PortForwarder

RequireNewHTTPPortForwarder creates a new port forwarder for the given namespace and selector. Returns a PortForwarder that automatically handles connection recovery during pod rolling updates.

Jump to

Keyboard shortcuts

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