...

Package registrytest

import "k8s.io/kubernetes/pkg/registry/registrytest"
Overview
Index

Overview ▾

Package registrytest provides tests for Registry implementations for storing Nodes, Pods, Schedulers and Services.

Index ▾

func AssertCategories(t *testing.T, storage rest.CategoriesProvider, expected []string)
func AssertShortNames(t *testing.T, storage rest.ShortNamesProvider, expected []string)
func MakeNodeList(nodes []string, nodeResources api.ResourceList) *api.NodeList
func NewEtcdStorage(t *testing.T, group string) (*storagebackend.ConfigForResource, *etcd3testing.EtcdTestServer)
func NewEtcdStorageForResource(t *testing.T, resource schema.GroupResource) (*storagebackend.ConfigForResource, *etcd3testing.EtcdTestServer)
func ValidateStorageStrategies(storageMap map[string]rest.Storage) []error
type EndpointRegistry
    func (e *EndpointRegistry) Create(ctx context.Context, endpoints runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error)
    func (e *EndpointRegistry) Delete(ctx context.Context, name string, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions) (runtime.Object, bool, error)
    func (e *EndpointRegistry) DeleteCollection(ctx context.Context, _ rest.ValidateObjectFunc, _ *metav1.DeleteOptions, _ *metainternalversion.ListOptions) (runtime.Object, error)
    func (e *EndpointRegistry) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error)
    func (e *EndpointRegistry) List(ctx context.Context, options *metainternalversion.ListOptions) (runtime.Object, error)
    func (e *EndpointRegistry) New() runtime.Object
    func (e *EndpointRegistry) NewList() runtime.Object
    func (e *EndpointRegistry) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, forceAllowCreateOnUpdate bool, options *metav1.UpdateOptions) (runtime.Object, bool, error)
    func (e *EndpointRegistry) Watch(ctx context.Context, options *metainternalversion.ListOptions) (watch.Interface, error)
type NodeRegistry
    func (r *NodeRegistry) CreateNode(ctx context.Context, node *api.Node) error
    func (r *NodeRegistry) DeleteNode(ctx context.Context, nodeID string) error
    func (r *NodeRegistry) GetNode(ctx context.Context, nodeID string, options *metav1.GetOptions) (*api.Node, error)
    func (r *NodeRegistry) ListNodes(ctx context.Context, options *metainternalversion.ListOptions) (*api.NodeList, error)
    func (r *NodeRegistry) SetError(err error)
    func (r *NodeRegistry) UpdateNode(ctx context.Context, node *api.Node) error
    func (r *NodeRegistry) WatchNodes(ctx context.Context, options *metainternalversion.ListOptions) (watch.Interface, error)
type ServiceRegistry
    func (r *ServiceRegistry) CreateService(ctx context.Context, svc *api.Service, createValidation rest.ValidateObjectFunc) (*api.Service, error)
    func (r *ServiceRegistry) DeleteService(ctx context.Context, id string) error
    func (r *ServiceRegistry) GetService(ctx context.Context, id string, options *metav1.GetOptions) (*api.Service, error)
    func (r *ServiceRegistry) ListServices(ctx context.Context, options *metainternalversion.ListOptions) (*api.ServiceList, error)
    func (r *ServiceRegistry) SetError(err error)
    func (r *ServiceRegistry) UpdateService(ctx context.Context, svc *api.Service, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc) (*api.Service, error)
    func (r *ServiceRegistry) WatchServices(ctx context.Context, options *metainternalversion.ListOptions) (watch.Interface, error)

Package files

categoriesProvider.go doc.go endpoint.go etcd.go node.go service.go shortNamesProvider.go validate.go

func AssertCategories

func AssertCategories(t *testing.T, storage rest.CategoriesProvider, expected []string)

func AssertShortNames

func AssertShortNames(t *testing.T, storage rest.ShortNamesProvider, expected []string)

func MakeNodeList

func MakeNodeList(nodes []string, nodeResources api.ResourceList) *api.NodeList

MakeNodeList constructs api.NodeList from list of node names and a NodeResource.

func NewEtcdStorage

func NewEtcdStorage(t *testing.T, group string) (*storagebackend.ConfigForResource, *etcd3testing.EtcdTestServer)

NewEtcdStorage is for testing. It configures the etcd storage for a bogus resource; the test must not care.

func NewEtcdStorageForResource

func NewEtcdStorageForResource(t *testing.T, resource schema.GroupResource) (*storagebackend.ConfigForResource, *etcd3testing.EtcdTestServer)

func ValidateStorageStrategies

func ValidateStorageStrategies(storageMap map[string]rest.Storage) []error

ValidateStorageStrategies ensures any instances of the generic registry.Store in the given storage map have expected strategies defined.

type EndpointRegistry

Registry is an interface for things that know how to store endpoints.

type EndpointRegistry struct {
    Endpoints *api.EndpointsList
    Updates   []api.Endpoints
    Err       error
    // contains filtered or unexported fields
}

func (*EndpointRegistry) Create

func (e *EndpointRegistry) Create(ctx context.Context, endpoints runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error)

func (*EndpointRegistry) Delete

func (e *EndpointRegistry) Delete(ctx context.Context, name string, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions) (runtime.Object, bool, error)

func (*EndpointRegistry) DeleteCollection

func (e *EndpointRegistry) DeleteCollection(ctx context.Context, _ rest.ValidateObjectFunc, _ *metav1.DeleteOptions, _ *metainternalversion.ListOptions) (runtime.Object, error)

func (*EndpointRegistry) Get

func (e *EndpointRegistry) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error)

func (*EndpointRegistry) List

func (e *EndpointRegistry) List(ctx context.Context, options *metainternalversion.ListOptions) (runtime.Object, error)

func (*EndpointRegistry) New

func (e *EndpointRegistry) New() runtime.Object

func (*EndpointRegistry) NewList

func (e *EndpointRegistry) NewList() runtime.Object

func (*EndpointRegistry) Update

func (e *EndpointRegistry) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, forceAllowCreateOnUpdate bool, options *metav1.UpdateOptions) (runtime.Object, bool, error)

func (*EndpointRegistry) Watch

func (e *EndpointRegistry) Watch(ctx context.Context, options *metainternalversion.ListOptions) (watch.Interface, error)

type NodeRegistry

NodeRegistry implements node.Registry interface.

type NodeRegistry struct {
    Err   error
    Node  string
    Nodes api.NodeList

    sync.Mutex
}

func (*NodeRegistry) CreateNode

func (r *NodeRegistry) CreateNode(ctx context.Context, node *api.Node) error

func (*NodeRegistry) DeleteNode

func (r *NodeRegistry) DeleteNode(ctx context.Context, nodeID string) error

func (*NodeRegistry) GetNode

func (r *NodeRegistry) GetNode(ctx context.Context, nodeID string, options *metav1.GetOptions) (*api.Node, error)

func (*NodeRegistry) ListNodes

func (r *NodeRegistry) ListNodes(ctx context.Context, options *metainternalversion.ListOptions) (*api.NodeList, error)

func (*NodeRegistry) SetError

func (r *NodeRegistry) SetError(err error)

func (*NodeRegistry) UpdateNode

func (r *NodeRegistry) UpdateNode(ctx context.Context, node *api.Node) error

func (*NodeRegistry) WatchNodes

func (r *NodeRegistry) WatchNodes(ctx context.Context, options *metainternalversion.ListOptions) (watch.Interface, error)

type ServiceRegistry

type ServiceRegistry struct {
    List    api.ServiceList
    Service *api.Service
    Updates []api.Service
    Err     error

    DeletedID string
    GottenID  string
    UpdatedID string
    // contains filtered or unexported fields
}

func (*ServiceRegistry) CreateService

func (r *ServiceRegistry) CreateService(ctx context.Context, svc *api.Service, createValidation rest.ValidateObjectFunc) (*api.Service, error)

func (*ServiceRegistry) DeleteService

func (r *ServiceRegistry) DeleteService(ctx context.Context, id string) error

func (*ServiceRegistry) GetService

func (r *ServiceRegistry) GetService(ctx context.Context, id string, options *metav1.GetOptions) (*api.Service, error)

func (*ServiceRegistry) ListServices

func (r *ServiceRegistry) ListServices(ctx context.Context, options *metainternalversion.ListOptions) (*api.ServiceList, error)

func (*ServiceRegistry) SetError

func (r *ServiceRegistry) SetError(err error)

func (*ServiceRegistry) UpdateService

func (r *ServiceRegistry) UpdateService(ctx context.Context, svc *api.Service, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc) (*api.Service, error)

func (*ServiceRegistry) WatchServices

func (r *ServiceRegistry) WatchServices(ctx context.Context, options *metainternalversion.ListOptions) (watch.Interface, error)