Help us shape the future of Go! Take the 2026 Go Developer Survey

testutil

package
v0.56.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package testutil provides shared helpers for operator E2E tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPodsReady

func CheckPodsReady(ctx context.Context, c client.Client, namespace string, labels map[string]string) error

CheckPodsReady checks that at least one pod matching the given labels is running and ready.

It passes the instant a single pod is observed ready, so it cannot gate on a multi-replica rollout -- use CheckPodsReadyCount when the workload has a known replica count.

func CheckPodsReadyCount added in v0.41.0

func CheckPodsReadyCount(
	ctx context.Context,
	c client.Client,
	namespace string,
	labels map[string]string,
	want int,
) error

CheckPodsReadyCount checks that exactly want pods matching the given labels are running and ready. Use this over CheckPodsReady whenever the expected replica count is known, so a gate on "the workload is up" cannot be satisfied by a partial rollout.

func CreateNodePortService

func CreateNodePortService(ctx context.Context, c client.Client, serverName, namespace string)

CreateNodePortService creates a NodePort service targeting the MCPServer proxy pods.

func DeployParameterizedOIDCServer added in v0.18.0

func DeployParameterizedOIDCServer(
	ctx context.Context,
	c client.Client,
	name, namespace string,
	timeout, pollingInterval time.Duration,
) (issuerURL string, allocatedNodePort int32, cleanup func())

DeployParameterizedOIDCServer deploys an in-cluster mock OIDC server that issues RSA-signed JWTs with a caller-controlled subject claim (via POST /token?subject=<name>). The server is exposed via a NodePort so the test process (running outside the cluster) can reach it.

Returns the in-cluster issuer URL (http://<name>.<namespace>.svc.cluster.local) and a cleanup function that removes all created resources.

func GetNodePort

func GetNodePort(
	ctx context.Context,
	c client.Client,
	serviceName, namespace string,
	timeout, pollingInterval time.Duration,
) int32

GetNodePort waits for a NodePort service to get a port assigned and returns it.

func GetPodLogs

func GetPodLogs(ctx context.Context, namespace, podName, containerName string, previous bool) (string, error)

GetPodLogs retrieves logs from a specific pod container.

func WaitForMCPServerRunning

func WaitForMCPServerRunning(
	ctx context.Context,
	c client.Client,
	name, namespace string,
	timeout, pollingInterval time.Duration,
)

WaitForMCPServerRunning waits for an MCPServer to reach the Running phase.

Types

This section is empty.

Jump to

Keyboard shortcuts

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