registrytest

package
v0.0.0-...-4eadfbb Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2017 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.NodeResources) *api.NodeList

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

func NewEtcdStorage

func NewEtcdStorage(t *testing.T, group string) (*storagebackend.Config, *etcdtesting.EtcdTestServer)

func ValidateStorageStrategies

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

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

Types

type EndpointRegistry

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

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

func (*EndpointRegistry) DeleteEndpoints

func (e *EndpointRegistry) DeleteEndpoints(ctx genericapirequest.Context, name string) error

func (*EndpointRegistry) GetEndpoints

func (e *EndpointRegistry) GetEndpoints(ctx genericapirequest.Context, name string, options *metav1.GetOptions) (*api.Endpoints, error)

func (*EndpointRegistry) ListEndpoints

func (*EndpointRegistry) UpdateEndpoints

func (e *EndpointRegistry) UpdateEndpoints(ctx genericapirequest.Context, endpoints *api.Endpoints) error

func (*EndpointRegistry) WatchEndpoints

type NodeRegistry

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

	sync.Mutex
}

NodeRegistry implements node.Registry interface.

func NewNodeRegistry

func NewNodeRegistry(nodes []string, nodeResources api.NodeResources) *NodeRegistry

func (*NodeRegistry) CreateNode

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

func (*NodeRegistry) DeleteNode

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

func (*NodeRegistry) GetNode

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

func (*NodeRegistry) ListNodes

func (*NodeRegistry) SetError

func (r *NodeRegistry) SetError(err error)

func (*NodeRegistry) UpdateNode

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

func (*NodeRegistry) WatchNodes

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 NewServiceRegistry

func NewServiceRegistry() *ServiceRegistry

func (*ServiceRegistry) CreateService

func (r *ServiceRegistry) CreateService(ctx genericapirequest.Context, svc *api.Service) (*api.Service, error)

func (*ServiceRegistry) DeleteService

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

func (*ServiceRegistry) ExportService

func (r *ServiceRegistry) ExportService(ctx genericapirequest.Context, name string, options metav1.ExportOptions) (*api.Service, error)

func (*ServiceRegistry) GetService

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

func (*ServiceRegistry) ListServices

func (*ServiceRegistry) SetError

func (r *ServiceRegistry) SetError(err error)

func (*ServiceRegistry) UpdateService

func (r *ServiceRegistry) UpdateService(ctx genericapirequest.Context, svc *api.Service) (*api.Service, error)

func (*ServiceRegistry) WatchServices

type StrategyExceptions

type StrategyExceptions struct {
	// HasExportStrategy is a list of the resource keys whose store should have a custom export strategy.
	HasExportStrategy []string
}

StrategyExceptions carries information on what exceptions to default strategy expectations are expected.

type Tester

type Tester struct {
	// contains filtered or unexported fields
}

func New

func New(t *testing.T, storage *genericregistry.Store) *Tester

func (*Tester) AllowCreateOnUpdate

func (t *Tester) AllowCreateOnUpdate() *Tester

func (*Tester) ClusterScope

func (t *Tester) ClusterScope() *Tester

func (*Tester) GeneratesName

func (t *Tester) GeneratesName() *Tester

func (*Tester) Namer

func (t *Tester) Namer(namer func(int) string) *Tester

func (*Tester) ReturnDeletedObject

func (t *Tester) ReturnDeletedObject() *Tester

func (*Tester) TestCreate

func (t *Tester) TestCreate(valid runtime.Object, invalid ...runtime.Object)

func (*Tester) TestDelete

func (t *Tester) TestDelete(valid runtime.Object)

func (*Tester) TestDeleteGraceful

func (t *Tester) TestDeleteGraceful(valid runtime.Object, expectedGrace int64)

func (*Tester) TestGet

func (t *Tester) TestGet(valid runtime.Object)

func (*Tester) TestList

func (t *Tester) TestList(valid runtime.Object)

func (*Tester) TestNamespace

func (t *Tester) TestNamespace() string

func (*Tester) TestUpdate

func (t *Tester) TestUpdate(valid runtime.Object, validUpdateFunc UpdateFunc, invalidUpdateFunc ...UpdateFunc)

func (*Tester) TestWatch

func (t *Tester) TestWatch(valid runtime.Object, labelsPass, labelsFail []labels.Set, fieldsPass, fieldsFail []fields.Set)

type UpdateFunc

type UpdateFunc func(runtime.Object) runtime.Object

Jump to

Keyboard shortcuts

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