fakes

package
v1.4.12 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HostPrimaryIpTest = "10.0.0.4"
	HostSubnetTest    = "10.0.0.0/24"
)

Functions

func NewFakeNodeNetworkConfigSpec added in v1.1.8

func NewFakeNodeNetworkConfigSpec(requestedIPCount int) v1alpha.NodeNetworkConfigSpec

func NewFakeScalar added in v1.1.8

func NewFakeScalar(releaseThreshold, requestThreshold, batchSize int) v1alpha.Scaler

Types

type HTTPServiceFake

type HTTPServiceFake struct {
	IPStateManager IPStateManager
	PoolMonitor    cns.IPAMPoolMonitor
}

func NewHTTPServiceFake

func NewHTTPServiceFake() *HTTPServiceFake

func (*HTTPServiceFake) GetAllocatedIPConfigs added in v1.1.8

func (fake *HTTPServiceFake) GetAllocatedIPConfigs() []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) SendNCSnapShotPeriodically

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

func (*HTTPServiceFake) SetNodeOrchestrator

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

func (*HTTPServiceFake) SetNumberOfAllocatedIPs added in v1.1.8

func (fake *HTTPServiceFake) SetNumberOfAllocatedIPs(desiredAllocatedIPCount 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 IPAMPoolMonitorFake added in v1.1.8

type IPAMPoolMonitorFake struct {
	FakeMinimumIps       int
	FakeMaximumIps       int
	FakeIpsNotInUseCount int
	FakecachedNNC        v1alpha.NodeNetworkConfig
}

func (*IPAMPoolMonitorFake) GetStateSnapshot added in v1.2.9

func (ipm *IPAMPoolMonitorFake) GetStateSnapshot() cns.IpamPoolMonitorStateSnapshot

func (*IPAMPoolMonitorFake) Reconcile added in v1.1.8

func (ipm *IPAMPoolMonitorFake) Reconcile() error

func (*IPAMPoolMonitorFake) Start added in v1.1.8

func (ipm *IPAMPoolMonitorFake) Start(ctx context.Context, poolMonitorRefreshMilliseconds int) error

func (*IPAMPoolMonitorFake) Update added in v1.1.8

type IPStateManager

type IPStateManager struct {
	PendingProgramIPConfigState map[string]cns.IPConfigurationStatus
	AvailableIPConfigState      map[string]cns.IPConfigurationStatus
	AllocatedIPConfigState      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) 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 ImdsClientTest added in v1.1.8

type ImdsClientTest struct{}

ImdsClient can be used to connect to VM Host agent in Azure.

func NewFakeImdsClient added in v1.1.8

func NewFakeImdsClient() *ImdsClientTest

func (*ImdsClientTest) GetNetworkContainerInfoFromHost added in v1.1.8

func (imdsClient *ImdsClientTest) GetNetworkContainerInfoFromHost(networkContainerID string, primaryAddress string, authToken string, apiVersion string) (*imdsclient.ContainerVersion, error)

GetNetworkContainerInfoFromHost - Mock implementation to return Container version info.

func (*ImdsClientTest) GetNetworkContainerInfoFromHostWithoutToken added in v1.1.9

func (imdsClient *ImdsClientTest) GetNetworkContainerInfoFromHostWithoutToken() int

GetNetworkContainerInfoFromHostWithoutToken - Mock implementation to return host NMAgent NC version Set it as 0 which is the same as default initial NC version for testing purpose

func (*ImdsClientTest) GetPrimaryInterfaceInfoFromHost added in v1.1.8

func (imdsClient *ImdsClientTest) GetPrimaryInterfaceInfoFromHost() (*imdsclient.InterfaceInfo, error)

GetPrimaryInterfaceInfoFromHost - Mock implementation to return Host interface info

func (*ImdsClientTest) GetPrimaryInterfaceInfoFromMemory added in v1.1.8

func (imdsClient *ImdsClientTest) GetPrimaryInterfaceInfoFromMemory() (*imdsclient.InterfaceInfo, error)

GetPrimaryInterfaceInfoFromMemory - Mock implementation to return host interface info

type NMAgentClientTest added in v1.2.2

type NMAgentClientTest struct{}

NMAgentClientTest can be used to query to VM Host info.

func NewFakeNMAgentClient added in v1.2.2

func NewFakeNMAgentClient() *NMAgentClientTest

NewFakeNMAgentClient return a mock implemetation of NMAgentClient

func (*NMAgentClientTest) GetNcVersionListWithOutToken added in v1.2.2

func (nmagentclient *NMAgentClientTest) GetNcVersionListWithOutToken(ncNeedUpdateList []string) map[string]int

GetNcVersionListWithOutToken is mock implementation to return nc version list.

type RequestControllerFake

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

func NewRequestControllerFake

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

func (*RequestControllerFake) CarveIPConfigsAndAddToStatusAndCNS

func (rc *RequestControllerFake) CarveIPConfigsAndAddToStatusAndCNS(numberOfIPConfigs int) []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

func (*RequestControllerFake) UpdateCRDSpec added in v1.1.8

func (rc *RequestControllerFake) UpdateCRDSpec(_ context.Context, desiredSpec v1alpha.NodeNetworkConfigSpec) error

type StringStack

type StringStack struct {
	// 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)

Jump to

Keyboard shortcuts

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