Documentation ¶
Index ¶
- Constants
- func BuildFakeClient(nodes []*apiv1.Node, pods []*apiv1.Pod) (*fake.Clientset, <-chan string)
- func BuildTestNode(opts NodeOpts) *apiv1.Node
- func BuildTestNodes(amount int, opts NodeOpts) []*apiv1.Node
- func BuildTestPod(opts PodOpts) *apiv1.Pod
- func BuildTestPods(amount int, opts PodOpts) []*apiv1.Pod
- func NameFromChan(c <-chan string, timeout time.Duration) string
- func NewTestNodeWatcher(nodes []*v1.Node, opts NodeListerOptions) (listerv1.NodeLister, error)
- func NewTestPodWatcher(pods []*v1.Pod, opts PodListerOptions) (listerv1.PodLister, error)
- type CloudProvider
- func (c *CloudProvider) GetInstance(node *v1.Node) (cloudprovider.Instance, error)
- func (c *CloudProvider) GetNodeGroup(id string) (cloudprovider.NodeGroup, bool)
- func (c *CloudProvider) Name() string
- func (c *CloudProvider) NodeGroups() []cloudprovider.NodeGroup
- func (c *CloudProvider) Refresh() error
- func (c *CloudProvider) RegisterNodeGroup(nodeGroup *NodeGroup)
- func (c *CloudProvider) RegisterNodeGroups(groups ...cloudprovider.NodeGroupConfig) error
- type Instance
- type MockAutoscalingService
- func (m MockAutoscalingService) AttachInstances(*autoscaling.AttachInstancesInput) (*autoscaling.AttachInstancesOutput, error)
- func (m MockAutoscalingService) CreateOrUpdateTags(*autoscaling.CreateOrUpdateTagsInput) (*autoscaling.CreateOrUpdateTagsOutput, error)
- func (m MockAutoscalingService) DescribeAutoScalingGroups(*autoscaling.DescribeAutoScalingGroupsInput) (*autoscaling.DescribeAutoScalingGroupsOutput, error)
- func (m MockAutoscalingService) SetDesiredCapacity(*autoscaling.SetDesiredCapacityInput) (*autoscaling.SetDesiredCapacityOutput, error)
- func (m MockAutoscalingService) TerminateInstanceInAutoScalingGroup(*autoscaling.TerminateInstanceInAutoScalingGroupInput) (*autoscaling.TerminateInstanceInAutoScalingGroupOutput, error)
- type MockEc2Service
- func (m MockEc2Service) CreateFleet(*ec2.CreateFleetInput) (*ec2.CreateFleetOutput, error)
- func (m MockEc2Service) DescribeInstanceStatusPages(statusInput *ec2.DescribeInstanceStatusInput, ...) error
- func (m MockEc2Service) DescribeInstances(*ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error)
- func (m MockEc2Service) TerminateInstances(*ec2.TerminateInstancesInput) (*ec2.TerminateInstancesOutput, error)
- type NodeGroup
- func (n *NodeGroup) Belongs(node *v1.Node) bool
- func (n *NodeGroup) DecreaseTargetSize(delta int64) error
- func (n *NodeGroup) DeleteNodes(nodes ...*v1.Node) error
- func (n *NodeGroup) ID() string
- func (n *NodeGroup) IncreaseSize(delta int64) error
- func (n *NodeGroup) MaxSize() int64
- func (n *NodeGroup) MinSize() int64
- func (n *NodeGroup) Name() string
- func (n *NodeGroup) Nodes() []string
- func (n *NodeGroup) Size() int64
- func (n *NodeGroup) String() string
- func (n *NodeGroup) TargetSize() int64
- type NodeListerOptions
- type NodeOpts
- type PodListerOptions
- type PodOpts
Constants ¶
const ProviderName = "test"
ProviderName is the mock cloud provider name for these tests
Variables ¶
This section is empty.
Functions ¶
func BuildFakeClient ¶
BuildFakeClient creates a fake client
func BuildTestNode ¶
BuildTestNode creates a node with specified capacity.
func BuildTestNodes ¶
BuildTestNodes creates multiple nodes with the same options
func BuildTestPod ¶
BuildTestPod builds a pod for testing
func BuildTestPods ¶
BuildTestPods creates multiple pods with the same options
func NameFromChan ¶
NameFromChan returns a name from a channel update fails if timeout
func NewTestNodeWatcher ¶
func NewTestNodeWatcher(nodes []*v1.Node, opts NodeListerOptions) (listerv1.NodeLister, error)
NewTestNodeWatcher creates a new mock NodeLister with the given nodes and options
func NewTestPodWatcher ¶
NewTestPodWatcher creates a new test PodLister with given pods and options
Types ¶
type CloudProvider ¶
type CloudProvider struct {
// contains filtered or unexported fields
}
CloudProvider implements the CloudProvider interface
func NewCloudProvider ¶
func NewCloudProvider(nodeGroupSize int) *CloudProvider
NewCloudProvider creates a new test CloudProvider
func (*CloudProvider) GetInstance ¶ added in v1.3.0
func (c *CloudProvider) GetInstance(node *v1.Node) (cloudprovider.Instance, error)
GetInstance mock implementation for test.CloudProvider
func (*CloudProvider) GetNodeGroup ¶
func (c *CloudProvider) GetNodeGroup(id string) (cloudprovider.NodeGroup, bool)
GetNodeGroup mock implementation for test.CloudProvider
func (*CloudProvider) Name ¶
func (c *CloudProvider) Name() string
Name mock implementation for test.CloudProvider
func (*CloudProvider) NodeGroups ¶
func (c *CloudProvider) NodeGroups() []cloudprovider.NodeGroup
NodeGroups mock implementation for test.CloudProvider
func (*CloudProvider) Refresh ¶
func (c *CloudProvider) Refresh() error
Refresh mock implementation for test.CloudProvider
func (*CloudProvider) RegisterNodeGroup ¶
func (c *CloudProvider) RegisterNodeGroup(nodeGroup *NodeGroup)
RegisterNodeGroup mock implementation for test.CloudProvider
func (*CloudProvider) RegisterNodeGroups ¶
func (c *CloudProvider) RegisterNodeGroups(groups ...cloudprovider.NodeGroupConfig) error
RegisterNodeGroups mock implementation for test.CloudProvider
type Instance ¶ added in v1.3.0
type Instance struct {
// contains filtered or unexported fields
}
Instance mock implementation
func (Instance) InstantiationTime ¶ added in v1.3.0
InstantiationTime mock for test.Instance
type MockAutoscalingService ¶
type MockAutoscalingService struct { autoscalingiface.AutoScalingAPI *client.Client AttachInstanceOutput *autoscaling.AttachInstancesOutput AttachInstanceErr error CreateOrUpdateTagsOutput *autoscaling.CreateOrUpdateTagsOutput CreateOrUpdateTagsErr error DescribeAutoScalingGroupsOutput *autoscaling.DescribeAutoScalingGroupsOutput DescribeAutoScalingGroupsErr error SetDesiredCapacityOutput *autoscaling.SetDesiredCapacityOutput SetDesiredCapacityErr error TerminateInstanceInAutoScalingGroupOutput *autoscaling.TerminateInstanceInAutoScalingGroupOutput TerminateInstanceInAutoScalingGroupErr error }
MockAutoscalingService is a mock implementation of a cloud provider interface
func (MockAutoscalingService) AttachInstances ¶ added in v1.10.0
func (m MockAutoscalingService) AttachInstances(*autoscaling.AttachInstancesInput) (*autoscaling.AttachInstancesOutput, error)
AttachInstances mock implementation for MockAutoscalingService
func (MockAutoscalingService) CreateOrUpdateTags ¶ added in v1.11.0
func (m MockAutoscalingService) CreateOrUpdateTags(*autoscaling.CreateOrUpdateTagsInput) (*autoscaling.CreateOrUpdateTagsOutput, error)
CreateOrUpdateTags mock implementation for MockAutoscalingService
func (MockAutoscalingService) DescribeAutoScalingGroups ¶
func (m MockAutoscalingService) DescribeAutoScalingGroups(*autoscaling.DescribeAutoScalingGroupsInput) (*autoscaling.DescribeAutoScalingGroupsOutput, error)
DescribeAutoScalingGroups mock implementation for MockAutoscalingService
func (MockAutoscalingService) SetDesiredCapacity ¶
func (m MockAutoscalingService) SetDesiredCapacity(*autoscaling.SetDesiredCapacityInput) (*autoscaling.SetDesiredCapacityOutput, error)
SetDesiredCapacity mock implementation for MockAutoscalingService
func (MockAutoscalingService) TerminateInstanceInAutoScalingGroup ¶
func (m MockAutoscalingService) TerminateInstanceInAutoScalingGroup(*autoscaling.TerminateInstanceInAutoScalingGroupInput) (*autoscaling.TerminateInstanceInAutoScalingGroupOutput, error)
TerminateInstanceInAutoScalingGroup mock implementation for MockAutoscalingService
type MockEc2Service ¶ added in v1.3.0
type MockEc2Service struct { ec2iface.EC2API *client.Client CreateFleetOutput *ec2.CreateFleetOutput CreateFleetErr error DescribeInstancesOutput *ec2.DescribeInstancesOutput DescribeInstancesErr error DescribeInstanceStatusOutput *ec2.DescribeInstanceStatusOutput DescribeInstanceStatusErr error AllInstancesReady bool TerminateInstancesOutput *ec2.TerminateInstancesOutput TerminateInstancesErr error }
MockEc2Service mocks the EC2API
func (MockEc2Service) CreateFleet ¶ added in v1.10.0
func (m MockEc2Service) CreateFleet(*ec2.CreateFleetInput) (*ec2.CreateFleetOutput, error)
CreateFleet mock implementation for MockEc2Service
func (MockEc2Service) DescribeInstanceStatusPages ¶ added in v1.10.0
func (m MockEc2Service) DescribeInstanceStatusPages(statusInput *ec2.DescribeInstanceStatusInput, allInstancesReadyHelper func(*ec2.DescribeInstanceStatusOutput, bool) bool) error
DescribeInstanceStatusPages mock implementation for MockEc2Service
func (MockEc2Service) DescribeInstances ¶ added in v1.3.0
func (m MockEc2Service) DescribeInstances(*ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error)
DescribeInstances mock implementation for MockEc2Service
func (MockEc2Service) TerminateInstances ¶ added in v1.12.0
func (m MockEc2Service) TerminateInstances(*ec2.TerminateInstancesInput) (*ec2.TerminateInstancesOutput, error)
TerminateInstances mock implementation for MockEc2Service
type NodeGroup ¶
type NodeGroup struct {
// contains filtered or unexported fields
}
NodeGroup is a mock implementation of NodeGroup for testing
func NewNodeGroup ¶
func NewNodeGroup(id string, name string, minSize int64, maxSize int64, targetSize int64) *NodeGroup
NewNodeGroup creates a new mock NodeGroup
func (*NodeGroup) DecreaseTargetSize ¶
DecreaseTargetSize mock implementation for NodeGroup
func (*NodeGroup) DeleteNodes ¶
DeleteNodes mock implementation for NodeGroup
func (*NodeGroup) IncreaseSize ¶
IncreaseSize mock implementation for NodeGroup
func (*NodeGroup) TargetSize ¶
TargetSize mock implementation for NodeGroup
type NodeListerOptions ¶
type NodeListerOptions struct {
ReturnErrorOnList bool
}
NodeListerOptions options for creating test NodeLister
type NodeOpts ¶
type NodeOpts struct { Name string CPU int64 Mem int64 LabelKey string LabelValue string Creation time.Time Tainted bool }
NodeOpts minimal options for configuring a node object in testing
type PodListerOptions ¶
type PodListerOptions struct {
ReturnErrorOnList bool
}
PodListerOptions for creating a new test PodLister
type PodOpts ¶
type PodOpts struct { Name string Namespace string CPU []int64 Mem []int64 NodeSelectorKey string NodeSelectorValue string Owner string NodeAffinityKey string NodeAffinityValue string NodeAffinityOp v1.NodeSelectorOperator NodeName string CPUOverhead int64 MemOverhead int64 InitContainersCPU []int64 InitContainersMem []int64 Phase v1.PodPhase Running bool }
PodOpts are options for a pod