fake

package
v0.0.0-...-d0c0f99 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package fake is a test-double implementation of cloudprovider Interface, LoadBalancer and Instances. It is useful for testing.

Index

Constants

View Source
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          []apiv1.ServicePort
	Hosts          []string
}

FakeBalancer is a fake storage of balancer information

type FakeCloud

type FakeCloud struct {
	Exists        bool
	Err           error
	Calls         []string
	Addresses     []apiv1.NodeAddress
	ExtID         map[types.NodeName]string
	InstanceTypes map[types.NodeName]string
	Machines      []types.NodeName
	NodeResources *apiv1.NodeResources
	ClusterList   []string
	MasterName    string
	ExternalIP    net.IP
	Balancers     map[string]FakeBalancer
	UpdateCalls   []FakeUpdateBalancerCall
	RouteMap      map[string]*FakeRoute
	Lock          sync.Mutex
}

FakeCloud is a test-double implementation of Interface, LoadBalancer, Instances, and Routes. It is useful for testing.

func (*FakeCloud) AddSSHKeyToAllInstances

func (f *FakeCloud) AddSSHKeyToAllInstances(user string, keyData []byte) error

func (*FakeCloud) ClearCalls

func (f *FakeCloud) ClearCalls()

ClearCalls clears internal record of method calls to this FakeCloud.

func (*FakeCloud) CurrentNodeName

func (f *FakeCloud) CurrentNodeName(hostname string) (types.NodeName, error)

Implementation of Instances.CurrentNodeName

func (*FakeCloud) ExternalID

func (f *FakeCloud) ExternalID(nodeName types.NodeName) (string, error)

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) Firewall

func (f *FakeCloud) Firewall() (cloudprovider.Firewall, bool)

Firewall returns a nil Firewall.

func (*FakeCloud) GetLoadBalancer

func (f *FakeCloud) GetLoadBalancer(clusterName string, service *apiv1.Service) (*apiv1.LoadBalancerStatus, bool, error)

GetLoadBalancer is a stub implementation of LoadBalancer.GetLoadBalancer.

func (*FakeCloud) InstanceID

func (f *FakeCloud) InstanceID(nodeName types.NodeName) (string, error)

InstanceID returns the cloud provider ID of the node with the specified Name.

func (*FakeCloud) InstanceType

func (f *FakeCloud) InstanceType(instance types.NodeName) (string, error)

InstanceType returns the type of the specified instance.

func (*FakeCloud) List

func (f *FakeCloud) List(filter string) ([]types.NodeName, error)

List is a test-spy implementation of Instances.List. It adds an entry "list" into the internal method call record.

func (*FakeCloud) NodeAddresses

func (f *FakeCloud) NodeAddresses(instance types.NodeName) ([]apiv1.NodeAddress, error)

NodeAddresses is a test-spy implementation of Instances.NodeAddresses. It adds an entry "node-addresses" into the internal method call record.

func (*FakeCloud) ProviderName

func (f *FakeCloud) ProviderName() string

ProviderName returns the cloud provider ID.

type FakeRoute

type FakeRoute struct {
	ClusterName string
}

type FakeUpdateBalancerCall

type FakeUpdateBalancerCall struct {
	Service *apiv1.Service
	Hosts   []string
}

Jump to

Keyboard shortcuts

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