kubernetes.v0: gopkg.in/kubernetes/kubernetes.v0/pkg/cloudprovider/fake Index | Files

package fake_cloud

import "gopkg.in/kubernetes/kubernetes.v0/pkg/cloudprovider/fake"

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

Index

Package Files

doc.go fake.go

Constants

const ProviderName = "fake"

type FakeBalancer Uses

type FakeBalancer struct {
    Name       string
    Region     string
    ExternalIP net.IP
    Ports      []*api.ServicePort
    Hosts      []string
}

FakeBalancer is a fake storage of balancer information

type FakeCloud Uses

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
    RouteMap      map[string]*FakeRoute
    Lock          sync.Mutex
    cloudprovider.Zone
}

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

func (*FakeCloud) AddSSHKeyToAllInstances Uses

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

func (*FakeCloud) ClearCalls Uses

func (f *FakeCloud) ClearCalls()

ClearCalls clears internal record of method calls to this FakeCloud.

func (*FakeCloud) Clusters Uses

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

func (*FakeCloud) CreateRoute Uses

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

func (*FakeCloud) CreateTCPLoadBalancer Uses

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

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

func (*FakeCloud) CurrentNodeName Uses

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

Implementation of Instances.CurrentNodeName

func (*FakeCloud) DeleteRoute Uses

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

func (*FakeCloud) EnsureTCPLoadBalancerDeleted Uses

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

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

func (*FakeCloud) ExternalID Uses

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 Uses

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

func (*FakeCloud) GetTCPLoadBalancer Uses

func (f *FakeCloud) GetTCPLoadBalancer(name, region string) (*api.LoadBalancerStatus, bool, error)

GetTCPLoadBalancer is a stub implementation of TCPLoadBalancer.GetTCPLoadBalancer.

func (*FakeCloud) GetZone Uses

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

func (*FakeCloud) InstanceID Uses

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

InstanceID returns the cloud provider ID of the specified instance.

func (*FakeCloud) Instances Uses

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

Instances returns a fake implementation of Instances.

Actually it just returns f itself.

func (*FakeCloud) List Uses

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 Uses

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

func (*FakeCloud) ListRoutes Uses

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

func (*FakeCloud) Master Uses

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

func (*FakeCloud) NodeAddresses Uses

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 Uses

func (f *FakeCloud) ProviderName() string

ProviderName returns the cloud provider ID.

func (*FakeCloud) Routes Uses

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

func (*FakeCloud) TCPLoadBalancer Uses

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

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

func (*FakeCloud) UpdateTCPLoadBalancer Uses

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 Uses

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

type FakeRoute Uses

type FakeRoute struct {
    ClusterName string
    Route       cloudprovider.Route
}

type FakeUpdateBalancerCall Uses

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

Package fake_cloud imports 7 packages (graph). Updated 2016-07-25. Refresh now. Tools for package owners.