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

fakes

package
v1.7.21 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HostPrimaryIP 10.0.0.4
	HostPrimaryIP = "10.0.0.4"
	// HostSubnet 10.0.0.0/24
	HostSubnet                   = "10.0.0.0/24"
	SimulateError MockIMDSCtxKey = "simulate-error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPServiceFake

type HTTPServiceFake struct {
	IPStateManager IPStateManager
	PoolMonitor    cns.IPAMPoolMonitor
}

func NewHTTPServiceFake

func NewHTTPServiceFake() *HTTPServiceFake

func (*HTTPServiceFake) AttachIPConfigsHandlerMiddleware

func (fake *HTTPServiceFake) AttachIPConfigsHandlerMiddleware(cns.IPConfigsHandlerMiddleware)

func (*HTTPServiceFake) GetAssignedIPConfigs

func (fake *HTTPServiceFake) GetAssignedIPConfigs() []cns.IPConfigurationStatus

func (*HTTPServiceFake) GetAvailableIPConfigs

func (fake *HTTPServiceFake) GetAvailableIPConfigs() []cns.IPConfigurationStatus

func (*HTTPServiceFake) GetOption

func (fake *HTTPServiceFake) GetOption(string) interface{}

func (*HTTPServiceFake) GetPendingProgramIPConfigs

func (fake *HTTPServiceFake) GetPendingProgramIPConfigs() []cns.IPConfigurationStatus

func (*HTTPServiceFake) GetPendingReleaseIPConfigs

func (fake *HTTPServiceFake) GetPendingReleaseIPConfigs() []cns.IPConfigurationStatus

func (*HTTPServiceFake) GetPodIPConfigState

func (fake *HTTPServiceFake) GetPodIPConfigState() map[string]cns.IPConfigurationStatus

Return union of all state maps

func (*HTTPServiceFake) Init

func (*HTTPServiceFake) MarkIPAsPendingRelease

func (fake *HTTPServiceFake) MarkIPAsPendingRelease(numberToMark int) (map[string]cns.IPConfigurationStatus, error)

TODO: Populate on scale down

func (*HTTPServiceFake) MarkNIPsPendingRelease

func (fake *HTTPServiceFake) MarkNIPsPendingRelease(n int) (map[string]cns.IPConfigurationStatus, error)

func (*HTTPServiceFake) SendNCSnapShotPeriodically

func (fake *HTTPServiceFake) SendNCSnapShotPeriodically(context.Context, int)

func (*HTTPServiceFake) SetNodeOrchestrator

func (fake *HTTPServiceFake) SetNodeOrchestrator(*cns.SetOrchestratorTypeRequest)

func (*HTTPServiceFake) SetNumberOfAssignedIPs

func (fake *HTTPServiceFake) SetNumberOfAssignedIPs(assign int) error

func (*HTTPServiceFake) SetOption

func (fake *HTTPServiceFake) SetOption(string, interface{})

func (*HTTPServiceFake) Start

func (fake *HTTPServiceFake) Start(*common.ServiceConfig) error

func (*HTTPServiceFake) Stop

func (fake *HTTPServiceFake) Stop()

func (*HTTPServiceFake) SyncHostNCVersion

func (fake *HTTPServiceFake) SyncHostNCVersion(context.Context, string, time.Duration)

SyncHostNCVersion will update HostVersion in containerstatus.

func (*HTTPServiceFake) SyncNodeStatus

type IPStateManager

type IPStateManager struct {
	PendingProgramIPConfigState map[string]cns.IPConfigurationStatus
	AvailableIPConfigState      map[string]cns.IPConfigurationStatus
	AssignedIPConfigState       map[string]cns.IPConfigurationStatus
	PendingReleaseIPConfigState map[string]cns.IPConfigurationStatus
	AvailableIPIDStack          StringStack
	sync.RWMutex
}

func NewIPStateManager

func NewIPStateManager() IPStateManager

func (*IPStateManager) AddIPConfigs

func (ipm *IPStateManager) AddIPConfigs(ipconfigs []cns.IPConfigurationStatus)

func (*IPStateManager) MarkIPAsPendingRelease

func (ipm *IPStateManager) MarkIPAsPendingRelease(numberOfIPsToMark int) (map[string]cns.IPConfigurationStatus, error)

func (*IPStateManager) MarkNIPsPendingRelease

func (ipm *IPStateManager) MarkNIPsPendingRelease(n int) (map[string]cns.IPConfigurationStatus, error)

func (*IPStateManager) ReleaseIPConfig

func (ipm *IPStateManager) ReleaseIPConfig(ipconfigID string) (cns.IPConfigurationStatus, error)

func (*IPStateManager) RemovePendingReleaseIPConfigs

func (ipm *IPStateManager) RemovePendingReleaseIPConfigs(ipconfigNames []string)

func (*IPStateManager) ReserveIPConfig

func (ipm *IPStateManager) ReserveIPConfig() (cns.IPConfigurationStatus, error)

type IPTablesLegacyMock

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

func (*IPTablesLegacyMock) Delete

func (c *IPTablesLegacyMock) Delete(_, _ string, _ ...string) error

func (*IPTablesLegacyMock) DeleteCallCount

func (c *IPTablesLegacyMock) DeleteCallCount() int

type IPTablesMock

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

func NewIPTablesMock

func NewIPTablesMock() *IPTablesMock

func (*IPTablesMock) Append

func (c *IPTablesMock) Append(table, chain string, rulespec ...string) error

func (*IPTablesMock) ChainExists

func (c *IPTablesMock) ChainExists(table, chain string) (bool, error)

func (*IPTablesMock) ClearChain

func (c *IPTablesMock) ClearChain(table, chain string) error

func (*IPTablesMock) ClearChainCallCount

func (c *IPTablesMock) ClearChainCallCount() int

func (*IPTablesMock) Delete

func (c *IPTablesMock) Delete(table, chain string, rulespec ...string) error

func (*IPTablesMock) Exists

func (c *IPTablesMock) Exists(table, chain string, rulespec ...string) (bool, error)

func (*IPTablesMock) Insert

func (c *IPTablesMock) Insert(table, chain string, pos int, rulespec ...string) error

func (*IPTablesMock) List

func (c *IPTablesMock) List(table, chain string) ([]string, error)

func (*IPTablesMock) NewChain

func (c *IPTablesMock) NewChain(table, chain string) error

type MockIMDSClient

type MockIMDSClient struct{}

func NewMockIMDSClient

func NewMockIMDSClient() *MockIMDSClient

func (*MockIMDSClient) GetIMDSVersions

func (m *MockIMDSClient) GetIMDSVersions(ctx context.Context) (*imds.APIVersionsResponse, error)

func (*MockIMDSClient) GetNetworkInterfaces

func (m *MockIMDSClient) GetNetworkInterfaces(ctx context.Context) ([]imds.NetworkInterface, error)

func (*MockIMDSClient) GetVMUniqueID

func (m *MockIMDSClient) GetVMUniqueID(ctx context.Context) (string, error)

type MockIMDSCtxKey

type MockIMDSCtxKey string

type MonitorFake

type MonitorFake struct {
	IPsNotInUseCount  int64
	NodeNetworkConfig *v1alpha.NodeNetworkConfig
}

func (*MonitorFake) GetStateSnapshot

func (f *MonitorFake) GetStateSnapshot() cns.IpamPoolMonitorStateSnapshot

func (*MonitorFake) Reconcile

func (*MonitorFake) Reconcile() error

func (*MonitorFake) Start

func (*MonitorFake) Start(ctx context.Context) error

func (*MonitorFake) Update

func (f *MonitorFake) Update(nnc *v1alpha.NodeNetworkConfig) error

type NMAgentClientFake

type NMAgentClientFake struct {
	SupportedAPIsF      func(context.Context) ([]string, error)
	GetNCVersionListF   func(context.Context) (nmagent.NCVersionList, error)
	GetHomeAzF          func(context.Context) (nmagent.AzResponse, error)
	GetInterfaceIPInfoF func(ctx context.Context) (nmagent.Interfaces, error)
}

NMAgentClientFake can be used to query to VM Host info.

func (*NMAgentClientFake) GetHomeAz

func (*NMAgentClientFake) GetInterfaceIPInfo

func (n *NMAgentClientFake) GetInterfaceIPInfo(ctx context.Context) (nmagent.Interfaces, error)

func (*NMAgentClientFake) GetNCVersionList

func (n *NMAgentClientFake) GetNCVersionList(ctx context.Context) (nmagent.NCVersionList, error)

func (*NMAgentClientFake) SupportedAPIs

func (n *NMAgentClientFake) SupportedAPIs(ctx context.Context) ([]string, error)

type RequestControllerFake

type RequestControllerFake struct {
	NNC *v1alpha.NodeNetworkConfig
	// contains filtered or unexported fields
}

func NewRequestControllerFake

func NewRequestControllerFake(cnsService *HTTPServiceFake, scalar v1alpha.Scaler, subnetAddressSpace string, numberOfIPConfigs int64) *RequestControllerFake

func (*RequestControllerFake) CarveIPConfigsAndAddToStatusAndCNS

func (rc *RequestControllerFake) CarveIPConfigsAndAddToStatusAndCNS(numberOfIPConfigs int64) []cns.IPConfigurationStatus

func (*RequestControllerFake) Init

func (*RequestControllerFake) IsStarted

func (rc *RequestControllerFake) IsStarted() bool

func (*RequestControllerFake) Reconcile

func (rc *RequestControllerFake) Reconcile(removePendingReleaseIPs bool) error

func (*RequestControllerFake) Start

type StringStack

type StringStack struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewStack

func NewStack() *StringStack

func (*StringStack) Pop

func (stack *StringStack) Pop() (string, error)

func (*StringStack) Push

func (stack *StringStack) Push(v string)

type WireserverClientFake

type WireserverClientFake struct{}

func (*WireserverClientFake) GetInterfaces

type WireserverProxyFake

type WireserverProxyFake struct {
	JoinNetworkFunc func(context.Context, string) (*http.Response, error)
	PublishNCFunc   func(context.Context, cns.NetworkContainerParameters, []byte) (*http.Response, error)
	UnpublishNCFunc func(context.Context, cns.NetworkContainerParameters, []byte) (*http.Response, error)
}

func (*WireserverProxyFake) JoinNetwork

func (w *WireserverProxyFake) JoinNetwork(ctx context.Context, vnetID string) (*http.Response, error)

func (*WireserverProxyFake) PublishNC

func (w *WireserverProxyFake) PublishNC(ctx context.Context, ncParams cns.NetworkContainerParameters, payload []byte) (*http.Response, error)

func (*WireserverProxyFake) UnpublishNC

func (w *WireserverProxyFake) UnpublishNC(ctx context.Context, ncParams cns.NetworkContainerParameters, payload []byte) (*http.Response, error)

Jump to

Keyboard shortcuts

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