Documentation ¶
Overview ¶
Package fake is a test-double implementation of cloudprovider Interface, LoadBalancer and Instances. It is useful for testing.
Index ¶
- Constants
- type FakeBalancer
- type FakeCloud
- func (f *FakeCloud) AddSSHKeyToAllInstances(user string, keyData []byte) error
- func (f *FakeCloud) ClearCalls()
- func (f *FakeCloud) Clusters() (cloudprovider.Clusters, bool)
- func (f *FakeCloud) CreateRoute(clusterName string, nameHint string, route *cloudprovider.Route) error
- func (f *FakeCloud) CurrentNodeName(hostname string) (types.NodeName, error)
- func (f *FakeCloud) DeleteRoute(clusterName string, route *cloudprovider.Route) error
- func (f *FakeCloud) EnsureLoadBalancer(clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error)
- func (f *FakeCloud) EnsureLoadBalancerDeleted(clusterName string, service *v1.Service) error
- func (f *FakeCloud) ExternalID(nodeName types.NodeName) (string, error)
- func (f *FakeCloud) GetLoadBalancer(clusterName string, service *v1.Service) (*v1.LoadBalancerStatus, bool, error)
- func (f *FakeCloud) GetZone() (cloudprovider.Zone, error)
- func (f *FakeCloud) InstanceID(nodeName types.NodeName) (string, error)
- func (f *FakeCloud) InstanceType(instance types.NodeName) (string, error)
- func (f *FakeCloud) Instances() (cloudprovider.Instances, bool)
- func (f *FakeCloud) List(filter string) ([]types.NodeName, error)
- func (f *FakeCloud) ListClusters() ([]string, error)
- func (f *FakeCloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, error)
- func (f *FakeCloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)
- func (f *FakeCloud) Master(name string) (string, error)
- func (f *FakeCloud) NodeAddresses(instance types.NodeName) ([]v1.NodeAddress, error)
- func (f *FakeCloud) ProviderName() string
- func (f *FakeCloud) Routes() (cloudprovider.Routes, bool)
- func (f *FakeCloud) ScrubDNS(nameservers, searches []string) (nsOut, srchOut []string)
- func (f *FakeCloud) UpdateLoadBalancer(clusterName string, service *v1.Service, nodes []*v1.Node) error
- func (f *FakeCloud) Zones() (cloudprovider.Zones, bool)
- type FakeRoute
- type FakeUpdateBalancerCall
Constants ¶
const ProviderName = "fake"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeBalancer ¶
type FakeBalancer struct { Name string Region string LoadBalancerIP string Ports []v1.ServicePort Hosts []*v1.Node }
FakeBalancer is a fake storage of balancer information
type FakeCloud ¶
type FakeCloud struct { Exists bool Err error Calls []string Addresses []v1.NodeAddress ExtID map[types.NodeName]string InstanceTypes map[types.NodeName]string Machines []types.NodeName NodeResources *v1.NodeResources ClusterList []string MasterName string ExternalIP net.IP Balancers map[string]FakeBalancer UpdateCalls []FakeUpdateBalancerCall RouteMap map[string]*FakeRoute Lock sync.Mutex cloudprovider.Zone }
FakeCloud is a test-double implementation of Interface, LoadBalancer, Instances, and Routes. It is useful for testing.
func (*FakeCloud) AddSSHKeyToAllInstances ¶
func (*FakeCloud) ClearCalls ¶
func (f *FakeCloud) ClearCalls()
ClearCalls clears internal record of method calls to this FakeCloud.
func (*FakeCloud) CreateRoute ¶
func (*FakeCloud) CurrentNodeName ¶
Implementation of Instances.CurrentNodeName
func (*FakeCloud) DeleteRoute ¶
func (f *FakeCloud) DeleteRoute(clusterName string, route *cloudprovider.Route) error
func (*FakeCloud) EnsureLoadBalancer ¶
func (f *FakeCloud) EnsureLoadBalancer(clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error)
EnsureLoadBalancer is a test-spy implementation of LoadBalancer.EnsureLoadBalancer. It adds an entry "create" into the internal method call record.
func (*FakeCloud) EnsureLoadBalancerDeleted ¶
EnsureLoadBalancerDeleted is a test-spy implementation of LoadBalancer.EnsureLoadBalancerDeleted. It adds an entry "delete" into the internal method call record.
func (*FakeCloud) ExternalID ¶
ExternalID is a test-spy implementation of Instances.ExternalID. It adds an entry "external-id" into the internal method call record. It returns an external id to the mapped instance name, if not found, it will return "ext-{instance}"
func (*FakeCloud) GetLoadBalancer ¶
func (f *FakeCloud) GetLoadBalancer(clusterName string, service *v1.Service) (*v1.LoadBalancerStatus, bool, error)
GetLoadBalancer is a stub implementation of LoadBalancer.GetLoadBalancer.
func (*FakeCloud) InstanceID ¶
InstanceID returns the cloud provider ID of the node with the specified Name.
func (*FakeCloud) InstanceType ¶
InstanceType returns the type of the specified instance.
func (*FakeCloud) Instances ¶
func (f *FakeCloud) Instances() (cloudprovider.Instances, bool)
Instances returns a fake implementation of Instances.
Actually it just returns f itself.
func (*FakeCloud) List ¶
List is a test-spy implementation of Instances.List. It adds an entry "list" into the internal method call record.
func (*FakeCloud) ListClusters ¶
func (*FakeCloud) ListRoutes ¶
func (f *FakeCloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, error)
func (*FakeCloud) LoadBalancer ¶
func (f *FakeCloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)
LoadBalancer returns a fake implementation of LoadBalancer. Actually it just returns f itself.
func (*FakeCloud) NodeAddresses ¶
NodeAddresses is a test-spy implementation of Instances.NodeAddresses. It adds an entry "node-addresses" into the internal method call record.
func (*FakeCloud) ProviderName ¶
ProviderName returns the cloud provider ID.
type FakeRoute ¶
type FakeRoute struct { ClusterName string Route cloudprovider.Route }