kubernetes: github.com/erimatnor/kubernetes/pkg/client/testclient Index | Files

package testclient

import "github.com/erimatnor/kubernetes/pkg/client/testclient"

Index

Package Files

fake_componentstatuses.go fake_endpoints.go fake_events.go fake_limit_ranges.go fake_namespaces.go fake_nodes.go fake_persistent_volume_claims.go fake_persistent_volumes.go fake_pods.go fake_replication_controllers.go fake_resource_quotas.go fake_secrets.go fake_services.go fixture.go testclient.go

Constants

const (
    GetControllerAction    = "get-replicationController"
    UpdateControllerAction = "update-replicationController"
    WatchControllerAction  = "watch-replicationController"
    DeleteControllerAction = "delete-replicationController"
    ListControllerAction   = "list-replicationControllers"
    CreateControllerAction = "create-replicationController"
)

func AddObjectsFromPath Uses

func AddObjectsFromPath(path string, o ObjectRetriever, decoder runtime.Decoder) error

AddObjectsFromPath loads the JSON or YAML file containing Kubernetes API resources and adds them to the provided ObjectRetriever.

type Fake Uses

type Fake struct {
    Actions []FakeAction
    Watch   watch.Interface
    Err     error

    // ReactFn is an optional function that will be invoked with the provided action
    // and return a response. It can implement scenario specific behavior. The type
    // of object returned must match the expected type from the caller (even if nil).
    ReactFn ReactionFunc
}

Fake implements client.Interface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the method you want to test easier.

func NewSimpleFake Uses

func NewSimpleFake(objects ...runtime.Object) *Fake

NewSimpleFake returns a client that will respond with the provided objects

func (*Fake) ComponentStatuses Uses

func (c *Fake) ComponentStatuses() client.ComponentStatusInterface

func (*Fake) Endpoints Uses

func (c *Fake) Endpoints(namespace string) client.EndpointsInterface

func (*Fake) Events Uses

func (c *Fake) Events(namespace string) client.EventInterface

func (*Fake) Invokes Uses

func (c *Fake) Invokes(action FakeAction, obj runtime.Object) (runtime.Object, error)

Invokes records the provided FakeAction and then invokes the ReactFn (if provided). obj is expected to be of the same type a normal call would return.

func (*Fake) LimitRanges Uses

func (c *Fake) LimitRanges(namespace string) client.LimitRangeInterface

func (*Fake) Namespaces Uses

func (c *Fake) Namespaces() client.NamespaceInterface

func (*Fake) Nodes Uses

func (c *Fake) Nodes() client.NodeInterface

func (*Fake) PersistentVolumeClaims Uses

func (c *Fake) PersistentVolumeClaims(namespace string) client.PersistentVolumeClaimInterface

func (*Fake) PersistentVolumes Uses

func (c *Fake) PersistentVolumes() client.PersistentVolumeInterface

func (*Fake) Pods Uses

func (c *Fake) Pods(namespace string) client.PodInterface

func (*Fake) ReplicationControllers Uses

func (c *Fake) ReplicationControllers(namespace string) client.ReplicationControllerInterface

func (*Fake) ResourceQuotas Uses

func (c *Fake) ResourceQuotas(namespace string) client.ResourceQuotaInterface

func (*Fake) Secrets Uses

func (c *Fake) Secrets(namespace string) client.SecretsInterface

func (*Fake) ServerAPIVersions Uses

func (c *Fake) ServerAPIVersions() (*api.APIVersions, error)

func (*Fake) ServerVersion Uses

func (c *Fake) ServerVersion() (*version.Info, error)

func (*Fake) Services Uses

func (c *Fake) Services(namespace string) client.ServiceInterface

type FakeAction Uses

type FakeAction struct {
    Action string
    Value  interface{}
}

type FakeComponentStatuses Uses

type FakeComponentStatuses struct {
    Fake *Fake
}

Fake implements ComponentStatusInterface.

func (*FakeComponentStatuses) Get Uses

func (c *FakeComponentStatuses) Get(name string) (*api.ComponentStatus, error)

func (*FakeComponentStatuses) List Uses

func (c *FakeComponentStatuses) List(label labels.Selector, field fields.Selector) (result *api.ComponentStatusList, err error)

type FakeEndpoints Uses

type FakeEndpoints struct {
    Fake      *Fake
    Namespace string
}

FakeEndpoints implements EndpointInterface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the method you want to test easier.

func (*FakeEndpoints) Create Uses

func (c *FakeEndpoints) Create(endpoints *api.Endpoints) (*api.Endpoints, error)

func (*FakeEndpoints) Delete Uses

func (c *FakeEndpoints) Delete(name string) error

func (*FakeEndpoints) Get Uses

func (c *FakeEndpoints) Get(name string) (*api.Endpoints, error)

func (*FakeEndpoints) List Uses

func (c *FakeEndpoints) List(selector labels.Selector) (*api.EndpointsList, error)

func (*FakeEndpoints) Update Uses

func (c *FakeEndpoints) Update(endpoints *api.Endpoints) (*api.Endpoints, error)

func (*FakeEndpoints) Watch Uses

func (c *FakeEndpoints) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)

type FakeEvents Uses

type FakeEvents struct {
    Fake *Fake
}

FakeEvents implements EventInterface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the method you want to test easier.

func (*FakeEvents) Create Uses

func (c *FakeEvents) Create(event *api.Event) (*api.Event, error)

Create makes a new event. Returns the copy of the event the server returns, or an error.

func (*FakeEvents) Delete Uses

func (c *FakeEvents) Delete(name string) error

func (*FakeEvents) Get Uses

func (c *FakeEvents) Get(id string) (*api.Event, error)

Get returns the given event, or an error.

func (*FakeEvents) GetFieldSelector Uses

func (c *FakeEvents) GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector

func (*FakeEvents) List Uses

func (c *FakeEvents) List(label labels.Selector, field fields.Selector) (*api.EventList, error)

List returns a list of events matching the selectors.

func (*FakeEvents) Search Uses

func (c *FakeEvents) Search(objOrRef runtime.Object) (*api.EventList, error)

Search returns a list of events matching the specified object.

func (*FakeEvents) Update Uses

func (c *FakeEvents) Update(event *api.Event) (*api.Event, error)

Update replaces an existing event. Returns the copy of the event the server returns, or an error.

func (*FakeEvents) Watch Uses

func (c *FakeEvents) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)

Watch starts watching for events matching the given selectors.

type FakeLimitRanges Uses

type FakeLimitRanges struct {
    Fake      *Fake
    Namespace string
}

FakeLimitRanges implements PodsInterface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the methods you want to test easier.

func (*FakeLimitRanges) Create Uses

func (c *FakeLimitRanges) Create(limitRange *api.LimitRange) (*api.LimitRange, error)

func (*FakeLimitRanges) Delete Uses

func (c *FakeLimitRanges) Delete(name string) error

func (*FakeLimitRanges) Get Uses

func (c *FakeLimitRanges) Get(name string) (*api.LimitRange, error)

func (*FakeLimitRanges) List Uses

func (c *FakeLimitRanges) List(selector labels.Selector) (*api.LimitRangeList, error)

func (*FakeLimitRanges) Update Uses

func (c *FakeLimitRanges) Update(limitRange *api.LimitRange) (*api.LimitRange, error)

func (*FakeLimitRanges) Watch Uses

func (c *FakeLimitRanges) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)

type FakeNamespaces Uses

type FakeNamespaces struct {
    Fake *Fake
}

FakeNamespaces implements NamespacesInterface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the methods you want to test easier.

func (*FakeNamespaces) Create Uses

func (c *FakeNamespaces) Create(namespace *api.Namespace) (*api.Namespace, error)

func (*FakeNamespaces) Delete Uses

func (c *FakeNamespaces) Delete(name string) error

func (*FakeNamespaces) Finalize Uses

func (c *FakeNamespaces) Finalize(namespace *api.Namespace) (*api.Namespace, error)

func (*FakeNamespaces) Get Uses

func (c *FakeNamespaces) Get(name string) (*api.Namespace, error)

func (*FakeNamespaces) List Uses

func (c *FakeNamespaces) List(labels labels.Selector, field fields.Selector) (*api.NamespaceList, error)

func (*FakeNamespaces) Status Uses

func (c *FakeNamespaces) Status(namespace *api.Namespace) (*api.Namespace, error)

func (*FakeNamespaces) Update Uses

func (c *FakeNamespaces) Update(namespace *api.Namespace) (*api.Namespace, error)

func (*FakeNamespaces) Watch Uses

func (c *FakeNamespaces) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)

type FakeNodes Uses

type FakeNodes struct {
    Fake *Fake
}

FakeNodes implements MinionInterface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the method you want to test easier.

func (*FakeNodes) Create Uses

func (c *FakeNodes) Create(minion *api.Node) (*api.Node, error)

func (*FakeNodes) Delete Uses

func (c *FakeNodes) Delete(name string) error

func (*FakeNodes) Get Uses

func (c *FakeNodes) Get(name string) (*api.Node, error)

func (*FakeNodes) List Uses

func (c *FakeNodes) List(label labels.Selector, field fields.Selector) (*api.NodeList, error)

func (*FakeNodes) Update Uses

func (c *FakeNodes) Update(minion *api.Node) (*api.Node, error)

func (*FakeNodes) UpdateStatus Uses

func (c *FakeNodes) UpdateStatus(minion *api.Node) (*api.Node, error)

func (*FakeNodes) Watch Uses

func (c *FakeNodes) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)

type FakePersistentVolumeClaims Uses

type FakePersistentVolumeClaims struct {
    Fake      *Fake
    Namespace string
}

func (*FakePersistentVolumeClaims) Create Uses

func (c *FakePersistentVolumeClaims) Create(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error)

func (*FakePersistentVolumeClaims) Delete Uses

func (c *FakePersistentVolumeClaims) Delete(name string) error

func (*FakePersistentVolumeClaims) Get Uses

func (c *FakePersistentVolumeClaims) Get(name string) (*api.PersistentVolumeClaim, error)

func (*FakePersistentVolumeClaims) List Uses

func (c *FakePersistentVolumeClaims) List(label labels.Selector, field fields.Selector) (*api.PersistentVolumeClaimList, error)

func (*FakePersistentVolumeClaims) Update Uses

func (c *FakePersistentVolumeClaims) Update(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error)

func (*FakePersistentVolumeClaims) UpdateStatus Uses

func (c *FakePersistentVolumeClaims) UpdateStatus(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error)

func (*FakePersistentVolumeClaims) Watch Uses

func (c *FakePersistentVolumeClaims) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)

type FakePersistentVolumes Uses

type FakePersistentVolumes struct {
    Fake      *Fake
    Namespace string
}

func (*FakePersistentVolumes) Create Uses

func (c *FakePersistentVolumes) Create(pv *api.PersistentVolume) (*api.PersistentVolume, error)

func (*FakePersistentVolumes) Delete Uses

func (c *FakePersistentVolumes) Delete(name string) error

func (*FakePersistentVolumes) Get Uses

func (c *FakePersistentVolumes) Get(name string) (*api.PersistentVolume, error)

func (*FakePersistentVolumes) List Uses

func (c *FakePersistentVolumes) List(label labels.Selector, field fields.Selector) (*api.PersistentVolumeList, error)

func (*FakePersistentVolumes) Update Uses

func (c *FakePersistentVolumes) Update(pv *api.PersistentVolume) (*api.PersistentVolume, error)

func (*FakePersistentVolumes) UpdateStatus Uses

func (c *FakePersistentVolumes) UpdateStatus(pv *api.PersistentVolume) (*api.PersistentVolume, error)

func (*FakePersistentVolumes) Watch Uses

func (c *FakePersistentVolumes) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)

type FakePods Uses

type FakePods struct {
    Fake      *Fake
    Namespace string
}

FakePods implements PodsInterface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the methods you want to test easier.

func (*FakePods) Bind Uses

func (c *FakePods) Bind(bind *api.Binding) error

func (*FakePods) Create Uses

func (c *FakePods) Create(pod *api.Pod) (*api.Pod, error)

func (*FakePods) Delete Uses

func (c *FakePods) Delete(name string, options *api.DeleteOptions) error

func (*FakePods) Get Uses

func (c *FakePods) Get(name string) (*api.Pod, error)

func (*FakePods) List Uses

func (c *FakePods) List(label labels.Selector, field fields.Selector) (*api.PodList, error)

func (*FakePods) Update Uses

func (c *FakePods) Update(pod *api.Pod) (*api.Pod, error)

func (*FakePods) UpdateStatus Uses

func (c *FakePods) UpdateStatus(pod *api.Pod) (*api.Pod, error)

func (*FakePods) Watch Uses

func (c *FakePods) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)

type FakeReplicationControllers Uses

type FakeReplicationControllers struct {
    Fake      *Fake
    Namespace string
}

FakeReplicationControllers implements ReplicationControllerInterface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the method you want to test easier.

func (*FakeReplicationControllers) Create Uses

func (c *FakeReplicationControllers) Create(controller *api.ReplicationController) (*api.ReplicationController, error)

func (*FakeReplicationControllers) Delete Uses

func (c *FakeReplicationControllers) Delete(name string) error

func (*FakeReplicationControllers) Get Uses

func (c *FakeReplicationControllers) Get(name string) (*api.ReplicationController, error)

func (*FakeReplicationControllers) List Uses

func (c *FakeReplicationControllers) List(selector labels.Selector) (*api.ReplicationControllerList, error)

func (*FakeReplicationControllers) Update Uses

func (c *FakeReplicationControllers) Update(controller *api.ReplicationController) (*api.ReplicationController, error)

func (*FakeReplicationControllers) Watch Uses

func (c *FakeReplicationControllers) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)

type FakeResourceQuotas Uses

type FakeResourceQuotas struct {
    Fake      *Fake
    Namespace string
}

FakeResourceQuotas implements ResourceQuotaInterface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the methods you want to test easier.

func (*FakeResourceQuotas) Create Uses

func (c *FakeResourceQuotas) Create(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error)

func (*FakeResourceQuotas) Delete Uses

func (c *FakeResourceQuotas) Delete(name string) error

func (*FakeResourceQuotas) Get Uses

func (c *FakeResourceQuotas) Get(name string) (*api.ResourceQuota, error)

func (*FakeResourceQuotas) List Uses

func (c *FakeResourceQuotas) List(selector labels.Selector) (*api.ResourceQuotaList, error)

func (*FakeResourceQuotas) Update Uses

func (c *FakeResourceQuotas) Update(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error)

func (*FakeResourceQuotas) UpdateStatus Uses

func (c *FakeResourceQuotas) UpdateStatus(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error)

func (*FakeResourceQuotas) Watch Uses

func (c *FakeResourceQuotas) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)

type FakeSecrets Uses

type FakeSecrets struct {
    Fake      *Fake
    Namespace string
}

Fake implements SecretInterface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the method you want to test easier.

func (*FakeSecrets) Create Uses

func (c *FakeSecrets) Create(secret *api.Secret) (*api.Secret, error)

func (*FakeSecrets) Delete Uses

func (c *FakeSecrets) Delete(name string) error

func (*FakeSecrets) Get Uses

func (c *FakeSecrets) Get(name string) (*api.Secret, error)

func (*FakeSecrets) List Uses

func (c *FakeSecrets) List(labels labels.Selector, field fields.Selector) (*api.SecretList, error)

func (*FakeSecrets) Update Uses

func (c *FakeSecrets) Update(secret *api.Secret) (*api.Secret, error)

func (*FakeSecrets) Watch Uses

func (c *FakeSecrets) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)

type FakeServices Uses

type FakeServices struct {
    Fake      *Fake
    Namespace string
}

Fake implements ServiceInterface. Meant to be embedded into a struct to get a default implementation. This makes faking out just the method you want to test easier.

func (*FakeServices) Create Uses

func (c *FakeServices) Create(service *api.Service) (*api.Service, error)

func (*FakeServices) Delete Uses

func (c *FakeServices) Delete(name string) error

func (*FakeServices) Get Uses

func (c *FakeServices) Get(name string) (*api.Service, error)

func (*FakeServices) List Uses

func (c *FakeServices) List(selector labels.Selector) (*api.ServiceList, error)

func (*FakeServices) Update Uses

func (c *FakeServices) Update(service *api.Service) (*api.Service, error)

func (*FakeServices) Watch Uses

func (c *FakeServices) Watch(label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)

type ObjectRetriever Uses

type ObjectRetriever interface {
    // Kind should return a resource or a list of resources (depending on the provided kind and
    // name). It should return an error if the caller should communicate an error to the server.
    Kind(kind, name string) (runtime.Object, error)
    // Add adds a runtime object for test purposes into this object.
    Add(runtime.Object) error
}

ObjectRetriever abstracts the implementation for retrieving or setting generic objects. It is intended to be used to fake calls to a server by returning objects based on their kind and name.

func NewObjects Uses

func NewObjects(scheme runtime.ObjectScheme, decoder runtime.ObjectDecoder) ObjectRetriever

NewObjects implements the ObjectRetriever interface by introspecting the objects provided to Add() and returning them when the Kind method is invoked. If an api.List object is provided to Add(), each child item is added. If an object is added that is itself a list (PodList, ServiceList) then that is added to the "PodList" kind. If no PodList is added, the retriever will take any loaded Pods and return them in a list. If an api.Status is added, and the Details.Kind field is set, that status will be returned instead (as an error if Status != Success, or as a runtime.Object if Status == Success). If multiple PodLists are provided, they will be returned in order by the Kind call, and the last PodList will be reused for subsequent calls.

type ReactionFunc Uses

type ReactionFunc func(FakeAction) (runtime.Object, error)

ReactionFunc is a function that returns an object or error for a given Action

func ObjectReaction Uses

func ObjectReaction(o ObjectRetriever, mapper meta.RESTMapper) ReactionFunc

ObjectReaction returns a ReactionFunc that takes a generic action string of the form <verb>-<resource> or <verb>-<subresource>-<resource> and attempts to return a runtime Object or error that matches the requested action. For instance, list-replicationControllers should attempt to return a list of replication controllers. This method delegates to the ObjectRetriever interface to satisfy retrieval of lists or retrieval of single items. TODO: add support for sub resources

Package testclient imports 15 packages (graph). Updated 2017-05-11. Refresh now. Tools for package owners.