fake

package
v1.5.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2016 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          []api.ServicePort
	Hosts          []string
}

FakeBalancer is a fake storage of balancer information

type FakeCloud

type FakeCloud struct {
	Exists        bool
	Err           error
	Calls         []string
	Addresses     []api.NodeAddress
	ExtID         map[string]string
	InstanceTypes map[string]string
	Machines      []string
	NodeResources *api.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 (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) Clusters

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

func (*FakeCloud) CreateRoute

func (f *FakeCloud) CreateRoute(clusterName string, nameHint string, route *cloudprovider.Route) error

func (*FakeCloud) CurrentNodeName

func (f *FakeCloud) CurrentNodeName(hostname string) (string, error)

Implementation of Instances.CurrentNodeName

func (*FakeCloud) DeleteRoute

func (f *FakeCloud) DeleteRoute(clusterName string, route *cloudprovider.Route) error

func (*FakeCloud) EnsureLoadBalancer added in v1.2.0

func (f *FakeCloud) EnsureLoadBalancer(clusterName string, service *api.Service, hosts []string) (*api.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 added in v1.2.0

func (f *FakeCloud) EnsureLoadBalancerDeleted(clusterName string, service *api.Service) error

EnsureLoadBalancerDeleted is a test-spy implementation of LoadBalancer.EnsureLoadBalancerDeleted. It adds an entry "delete" into the internal method call record.

func (*FakeCloud) ExternalID

func (f *FakeCloud) ExternalID(instance string) (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) GetLoadBalancer added in v1.2.0

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

GetLoadBalancer is a stub implementation of LoadBalancer.GetLoadBalancer.

func (*FakeCloud) GetZone

func (f *FakeCloud) GetZone() (cloudprovider.Zone, error)

func (*FakeCloud) InstanceID

func (f *FakeCloud) InstanceID(instance string) (string, error)

InstanceID returns the cloud provider ID of the specified instance.

func (*FakeCloud) InstanceType added in v1.2.0

func (f *FakeCloud) InstanceType(instance string) (string, error)

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

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

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

func (*FakeCloud) ListClusters

func (f *FakeCloud) ListClusters() ([]string, error)

func (*FakeCloud) ListRoutes

func (f *FakeCloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, error)

func (*FakeCloud) LoadBalancer added in v1.2.0

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

LoadBalancer returns a fake implementation of LoadBalancer. Actually it just returns f itself.

func (*FakeCloud) Master

func (f *FakeCloud) Master(name string) (string, error)

func (*FakeCloud) NodeAddresses

func (f *FakeCloud) NodeAddresses(instance string) ([]api.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.

func (*FakeCloud) Routes

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

func (*FakeCloud) ScrubDNS added in v1.1.1

func (f *FakeCloud) ScrubDNS(nameservers, searches []string) (nsOut, srchOut []string)

ScrubDNS filters DNS settings for pods.

func (*FakeCloud) UpdateLoadBalancer added in v1.2.0

func (f *FakeCloud) UpdateLoadBalancer(clusterName string, service *api.Service, hosts []string) error

UpdateLoadBalancer is a test-spy implementation of LoadBalancer.UpdateLoadBalancer. It adds an entry "update" into the internal method call record.

func (*FakeCloud) Zones

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

type FakeRoute

type FakeRoute struct {
	ClusterName string
	Route       cloudprovider.Route
}

type FakeUpdateBalancerCall

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

Jump to

Keyboard shortcuts

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