testutils

package
v0.0.0-...-003732d Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TestAPITimeout          = time.Second * 10
	TestRetryInterval       = time.Millisecond * 10
	TestInitialSetupTimeout = time.Minute
)

Functions

func AreIPsInSameSubnet

func AreIPsInSameSubnet(ip1, ip2, subnet string) bool

func AssertEventually

func AssertEventually(check func() error, timeout, interval, additional_timeout time.Duration,
	msg string, onFirstFailure func(), onSecondFailure func())

func BuildAndPush

func BuildAndPush(ctx context.Context, dockerfilePath string, image ContainerImage) error

func BuildContainer

func BuildContainer(ctx context.Context, dockerfilePath string, tag string) error

func ConfigureDpuOperator

func ConfigureDpuOperator(c client.Client, configFile string) error

func CreateClientsFromConfig

func CreateClientsFromConfig(restConfig *rest.Config) (client.Client, kubernetes.Interface, error)

func CreateDpuOperatorCR

func CreateDpuOperatorCR(client client.Client, cr *configv1.DpuOperatorConfig)

func CreateDpuOperatorCRWithRetry

func CreateDpuOperatorCRWithRetry(client client.Client, cr *configv1.DpuOperatorConfig) error

func CreateNamespace

func CreateNamespace(client client.Client, ns *corev1.Namespace)

func CreateNamespaceWithRetry

func CreateNamespaceWithRetry(client client.Client, ns *corev1.Namespace) error

func DeleteAndEventuallyPodDoesNotExist

func DeleteAndEventuallyPodDoesNotExist(c client.Client, podName string, podNamespace string, timeout time.Duration, interval time.Duration)

func DeleteDpuOperatorCR

func DeleteDpuOperatorCR(client client.Client, cr *configv1.DpuOperatorConfig)

func DeleteNamespace

func DeleteNamespace(client client.Client, ns *corev1.Namespace)

func DpuOperatorCR

func DpuOperatorCR(name string, ns *corev1.Namespace) *configv1.DpuOperatorConfig

func DpuOperatorNamespace

func DpuOperatorNamespace() *corev1.Namespace

func EnsurePullAndPush

func EnsurePullAndPush(ctx context.Context, sourceImage, targetImage ContainerImage) error

func EventuallyDpuOperatorConfigReady

func EventuallyDpuOperatorConfigReady(c client.Client, logger logr.Logger, cr *configv1.DpuOperatorConfig, timeout time.Duration, interval time.Duration) *configv1.DpuOperatorConfig

func EventuallyNoDpuOperatorConfig

func EventuallyNoDpuOperatorConfig(c client.Client, timeout time.Duration, interval time.Duration)

func EventuallyPodDoesNotExist

func EventuallyPodDoesNotExist(c client.Client, podName string, podNamespace string, timeout time.Duration, interval time.Duration)

func EventuallyPodIsRunning

func EventuallyPodIsRunning(c client.Client, podName string, podNamespace string, timeout time.Duration, interval time.Duration) *corev1.Pod

func ExecInPod

func ExecInPod(clientset kubernetes.Interface, config *rest.Config, pod *corev1.Pod, command string) (string, error)

func GenerateAvailableIP

func GenerateAvailableIP(subnet string, usedIPs map[string]bool) string

func GetDPUHostNodes

func GetDPUHostNodes(c client.Client) ([]corev1.Node, error)

func GetDPUNodes

func GetDPUNodes(c client.Client) ([]corev1.Node, error)

func GetDpuOperatorConfig

func GetDpuOperatorConfig(c client.Client, name string) *configv1.DpuOperatorConfig

func GetFirstNode

func GetFirstNode(c client.Client) (corev1.Node, error)

func GetGatewayFromSubnet

func GetGatewayFromSubnet(subnet string) string

Assume a standard /24 subnet for simplicity

func GetPod

func GetPod(c client.Client, name string, namespace string) *corev1.Pod

func GetPodEvents

func GetPodEvents(c client.Client, podName string, podNamespace string) string

func GetSecondaryNetworkIP

func GetSecondaryNetworkIP(pod *corev1.Pod, netdevName string) (string, error)

func GetSubnet

func GetSubnet(ip string) string

func IsDpuOperatorConfigReady

func IsDpuOperatorConfigReady(c client.Client, name string) error

func IsMasterNode

func IsMasterNode(node corev1.Node) bool

func LabelAllNodesWithDpu

func LabelAllNodesWithDpu(c client.Client) error

func LabelNodesForDpu

func LabelNodesForDpu(c client.Client, dpuSide string) error

func LabelNodesWithDpu

func LabelNodesWithDpu(c client.Client) error

func LabelSingleNodeWithDpu

func LabelSingleNodeWithDpu(c client.Client, node *corev1.Node) error

func LabelWorkerNodesWithDpu

func LabelWorkerNodesWithDpu(c client.Client) error

func LogDpuOperatorConfigDiagnostics

func LogDpuOperatorConfigDiagnostics(c client.Client, name string) string

func LogPodDiagnostics

func LogPodDiagnostics(c client.Client, podName string, podNamespace string) string

func NewTestPod

func NewTestPod(podName string, nodeHostname string) *corev1.Pod

func NewTestSfc

func NewTestSfc(sfcName string, nfName string) *configv1.ServiceFunctionChain

func PodGetDpuResourceRequests

func PodGetDpuResourceRequests(pod *corev1.Pod) int

func PodIsRunning

func PodIsRunning(c client.Client, podName string, podNamespace string) bool

func PullContainer

func PullContainer(ctx context.Context, imageRef string, arch string, tag string) error

func PushContainer

func PushContainer(ctx context.Context, imageRef string) error

func RemoteImageExists

func RemoteImageExists(ctx context.Context, image ContainerImage) (bool, error)

func SetDpuOperatorConfigReady

func SetDpuOperatorConfigReady(c client.Client, name string)

func SetupDpuOperator

func SetupDpuOperator(c client.Client, configFile string) error

func SetupDpuOperatorConfig

func SetupDpuOperatorConfig(c client.Client, configFile string) error

func SetupDpuOperatorWithRetry

func SetupDpuOperatorWithRetry(c client.Client, configFile string) error

func SfcGet

func SfcGet(c client.Client, name string, namespace string) *configv1.ServiceFunctionChain

func SfcList

func SfcList(c client.Client, namespace string) *configv1.ServiceFunctionChainList

func SfcNew

func SfcNew(namespace, sfcName, nfName, nfImage string) *configv1.ServiceFunctionChain

func SfcWait

func SfcWait(c client.Client, name, namespace string, timeout time.Duration) *configv1.ServiceFunctionChain

func TrafficFlowTestsImage

func TrafficFlowTestsImage() string

TrafficFlowTestsImage returns the appropriate image reference based on USE_LOCAL_REGISTRY

func TryEventually

func TryEventually(check func() error, timeout, interval time.Duration) error

func WaitAllNodesReady

func WaitAllNodesReady(client client.Client)

func WaitForAllPodsReady

func WaitForAllPodsReady(c client.Client, namespace string) error

func WaitForDPU

func WaitForDPU(c client.Client) error

func WaitForDPUReady

func WaitForDPUReady(c client.Client) error

func WaitForDaemonSetReady

func WaitForDaemonSetReady(daemonSet *appsv1.DaemonSet, k8sClient client.Client, namespace, name string)

Types

type CdaCluster

type CdaCluster struct {
	Name           string
	KubeconfigPath string
}

func (*CdaCluster) EnsureExists

func (t *CdaCluster) EnsureExists(kubeconfigPath string) (*rest.Config, error)

type Cluster

type Cluster interface {
	EnsureExists() *rest.Config
	EnsureDeleted()
}

type ContainerImage

type ContainerImage struct {
	Registry string
	Name     string
	Tag      string
}

func (ContainerImage) FullRef

func (ci ContainerImage) FullRef() string

func (ContainerImage) LocalRef

func (ci ContainerImage) LocalRef() string

type KindCluster

type KindCluster struct {
	Name string
}

func (*KindCluster) EnsureDeleted

func (t *KindCluster) EnsureDeleted()

func (*KindCluster) EnsureExists

func (t *KindCluster) EnsureExists() *rest.Config

func (*KindCluster) TempDirPath

func (t *KindCluster) TempDirPath() string

type NetworkStatus

type NetworkStatus struct {
	Name      string   `json:"name"`
	Interface string   `json:"interface"`
	IPs       []string `json:"ips"`
	Mac       string   `json:"mac"`
	DNS       struct{} `json:"dns"`
}

Jump to

Keyboard shortcuts

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