package fake_cloud

import "k8s.io/kubernetes/pkg/cloudprovider/fake"

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

Index

Types

type FakeBalancer

type FakeBalancer struct {
	Name       string
	Region     string
	ExternalIP net.IP
	Ports      []int
	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
	Machines      []string
	NodeResources *api.NodeResources
	ClusterList   []string
	MasterName    string
	ExternalIP    net.IP
	Balancers     []FakeBalancer
	UpdateCalls   []FakeUpdateBalancerCall
	cloudprovider.Zone
}

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

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

func (f *FakeCloud) CreateTCPLoadBalancer(name, region string, externalIP net.IP, ports []int, hosts []string, affinityType api.AffinityType) (string, error)

CreateTCPLoadBalancer is a test-spy implementation of TCPLoadBalancer.CreateTCPLoadBalancer. It adds an entry "create" into the internal method call record.

func (*FakeCloud) DeleteTCPLoadBalancer

func (f *FakeCloud) DeleteTCPLoadBalancer(name, region string) error

DeleteTCPLoadBalancer is a test-spy implementation of TCPLoadBalancer.DeleteTCPLoadBalancer. 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) GetNodeResources

func (f *FakeCloud) GetNodeResources(name string) (*api.NodeResources, error)

func (*FakeCloud) GetZone

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

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

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

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

func (*FakeCloud) TCPLoadBalancerExists

func (f *FakeCloud) TCPLoadBalancerExists(name, region string) (bool, error)

TCPLoadBalancerExists is a stub implementation of TCPLoadBalancer.TCPLoadBalancerExists.

func (*FakeCloud) UpdateTCPLoadBalancer

func (f *FakeCloud) UpdateTCPLoadBalancer(name, region string, hosts []string) error

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

func (*FakeCloud) Zones

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

type FakeUpdateBalancerCall

type FakeUpdateBalancerCall struct {
	Name   string
	Region string
	Hosts  []string
}

Source Files

doc.go fake.go

Version
v0.16.2
Published
May 4, 2015
Platform
js/wasm
Imports
4 packages
Last checked
40 seconds ago

Tools for package owners.