testutil

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package testutil provides testing utilities for the ENI manager components

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTestNodeENI

func CreateTestNodeENI(name, nodeName string, enableDPDK bool) networkingv1alpha1.NodeENI

CreateTestNodeENI creates a test NodeENI resource

func TestConfig

func TestConfig() *config.ENIManagerConfig

TestConfig provides a test configuration

Types

type MockDPDKBoundInterface

type MockDPDKBoundInterface struct {
	PCIAddress    string
	Driver        string
	NodeENIName   string
	ENIID         string
	InterfaceName string
	BoundAt       time.Time
}

MockDPDKBoundInterface represents a mock DPDK bound interface

type MockDPDKManager

type MockDPDKManager struct {
	// contains filtered or unexported fields
}

MockDPDKManager provides a mock implementation of the DPDK manager

func NewMockDPDKManager

func NewMockDPDKManager() *MockDPDKManager

NewMockDPDKManager creates a new mock DPDK manager

func (*MockDPDKManager) BindPCIDeviceToDPDK

func (m *MockDPDKManager) BindPCIDeviceToDPDK(pciAddress string, driver string) error

BindPCIDeviceToDPDK mocks binding a PCI device to DPDK

func (*MockDPDKManager) GetBoundInterfaces

func (m *MockDPDKManager) GetBoundInterfaces() map[string]MockDPDKBoundInterface

GetBoundInterfaces returns mock bound interfaces

func (*MockDPDKManager) IsPCIDeviceBoundToDPDK

func (m *MockDPDKManager) IsPCIDeviceBoundToDPDK(pciAddress string, driver string) (bool, error)

IsPCIDeviceBoundToDPDK mocks checking if a PCI device is bound to DPDK

func (*MockDPDKManager) SetOperationFailure

func (m *MockDPDKManager) SetOperationFailure(operation string, shouldFail bool)

SetOperationFailure sets whether an operation should fail

type MockKubernetesClient

type MockKubernetesClient struct {
	// contains filtered or unexported fields
}

MockKubernetesClient provides a mock implementation of the Kubernetes client

func NewMockKubernetesClient

func NewMockKubernetesClient() *MockKubernetesClient

NewMockKubernetesClient creates a new mock Kubernetes client

func (*MockKubernetesClient) AddNodeENI

func (m *MockKubernetesClient) AddNodeENI(nodeENI networkingv1alpha1.NodeENI)

AddNodeENI adds a mock NodeENI resource

func (*MockKubernetesClient) GetNodeENIResources

func (m *MockKubernetesClient) GetNodeENIResources(ctx context.Context, nodeName string) ([]networkingv1alpha1.NodeENI, error)

GetNodeENIResources returns mock NodeENI resources

func (*MockKubernetesClient) SetOperationFailure

func (m *MockKubernetesClient) SetOperationFailure(operation string, shouldFail bool)

SetOperationFailure sets whether an operation should fail

type MockNetworkManager

type MockNetworkManager struct {
	// contains filtered or unexported fields
}

MockNetworkManager provides a mock implementation of the network manager

func NewMockNetworkManager

func NewMockNetworkManager() *MockNetworkManager

NewMockNetworkManager creates a new mock network manager

func (*MockNetworkManager) AddInterface

func (m *MockNetworkManager) AddInterface(name string, state string, mtu int, isAWSENI bool)

AddInterface adds a mock interface

func (*MockNetworkManager) BringDownInterface

func (m *MockNetworkManager) BringDownInterface(ifaceName string) error

BringDownInterface mocks bringing down an interface

func (*MockNetworkManager) BringUpInterface

func (m *MockNetworkManager) BringUpInterface(ifaceName string) error

BringUpInterface mocks bringing up an interface

func (*MockNetworkManager) GetAllInterfaces

func (m *MockNetworkManager) GetAllInterfaces() ([]network.InterfaceInfo, error)

GetAllInterfaces returns all mock interfaces

func (*MockNetworkManager) GetInterfaceMTU

func (m *MockNetworkManager) GetInterfaceMTU(ifaceName string) int

GetInterfaceMTU returns the current MTU of an interface

func (*MockNetworkManager) GetInterfaceState

func (m *MockNetworkManager) GetInterfaceState(ifaceName string) string

GetInterfaceState returns the current state of an interface

func (*MockNetworkManager) SetMTU

func (m *MockNetworkManager) SetMTU(ifaceName string, mtu int) error

SetMTU mocks setting MTU

func (*MockNetworkManager) SetOperationFailure

func (m *MockNetworkManager) SetOperationFailure(operation string, shouldFail bool)

SetOperationFailure sets whether an operation should fail

Jump to

Keyboard shortcuts

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