v1

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: Apache-2.0 Imports: 20 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasFieldSelector

func HasFieldSelector(keyAndValues ...string) func(t *testing.T, a interface{})

HasFieldSelector returns a comparable which can be used for asserting that list methods are called with the appropriate field selectors

func HasLabelSelector

func HasLabelSelector(keyAndValues ...string) func(t *testing.T, a interface{})

HasLabelSelector returns a comparable which can be used for asserting that list methods are called with the appropriate label selector

func HasSelector

func HasSelector(labelKeysAndValues []string, fieldKeysAndValue []string) func(t *testing.T, a interface{})

HasSelector returns a comparable which can be used for asserting that list methods are called with the appropriate label and field selectors

Types

type KnServingClient

type KnServingClient interface {

	// Namespace in which this client is operating for
	Namespace() string

	// Get a service by its unique name
	GetService(name string) (*servingv1.Service, error)

	// List services
	ListServices(opts ...ListConfig) (*servingv1.ServiceList, error)

	// Create a new service
	CreateService(service *servingv1.Service) error

	// UpdateService updates the given service. For a more robust variant with automatic
	// conflict resolution see UpdateServiceWithRetry
	UpdateService(service *servingv1.Service) error

	// UpdateServiceWithRetry updates service and retries if there is a version conflict.
	// The updateFunc receives a deep copy of the existing service and can add update it in
	// place.
	UpdateServiceWithRetry(name string, updateFunc serviceUpdateFunc, nrRetries int) error

	// Delete a service by name
	DeleteService(name string, timeout time.Duration) error

	// Wait for a service to become ready, but not longer than provided timeout.
	// Return error and how long has been waited
	WaitForService(name string, timeout time.Duration, msgCallback wait.MessageCallback) (error, time.Duration)

	// Get a configuration by name
	GetConfiguration(name string) (*servingv1.Configuration, error)

	// Get a revision by name
	GetRevision(name string) (*servingv1.Revision, error)

	// Get the "base" revision for a Service; the one that corresponds to the
	// current template.
	GetBaseRevision(service *servingv1.Service) (*servingv1.Revision, error)

	// List revisions
	ListRevisions(opts ...ListConfig) (*servingv1.RevisionList, error)

	// Delete a revision
	DeleteRevision(name string, timeout time.Duration) error

	// Get a route by its unique name
	GetRoute(name string) (*servingv1.Route, error)

	// List routes
	ListRoutes(opts ...ListConfig) (*servingv1.RouteList, error)
}

Kn interface to serving. All methods are relative to the namespace specified during construction

func NewKnServingClient

func NewKnServingClient(client clientv1.ServingV1Interface, namespace string) KnServingClient

Create a new client facade for the provided namespace

type ListConfig

type ListConfig func(config *listConfigCollector)

Config function for builder pattern

func WithName

func WithName(name string) ListConfig

Filter list on the provided name

func WithService

func WithService(service string) ListConfig

Filter on the service name

type ListConfigs

type ListConfigs []ListConfig

type MockKnServingClient

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

func NewMockKnServiceClient

func NewMockKnServiceClient(t *testing.T, ns ...string) *MockKnServingClient

NewMockKnServiceClient returns a new mock instance which you need to record for

func (*MockKnServingClient) CreateService

func (c *MockKnServingClient) CreateService(service *servingv1.Service) error

func (*MockKnServingClient) DeleteRevision

func (c *MockKnServingClient) DeleteRevision(name string, timeout time.Duration) error

func (*MockKnServingClient) DeleteService

func (c *MockKnServingClient) DeleteService(name string, timeout time.Duration) error

func (*MockKnServingClient) GetBaseRevision

func (c *MockKnServingClient) GetBaseRevision(service *servingv1.Service) (*servingv1.Revision, error)

Check for the base reviision

func (*MockKnServingClient) GetConfiguration

func (c *MockKnServingClient) GetConfiguration(name string) (*servingv1.Configuration, error)

GetConfiguration returns a configuration looked up by name

func (*MockKnServingClient) GetRevision

func (c *MockKnServingClient) GetRevision(name string) (*servingv1.Revision, error)

func (*MockKnServingClient) GetRoute

func (c *MockKnServingClient) GetRoute(name string) (*servingv1.Route, error)

func (*MockKnServingClient) GetService

func (c *MockKnServingClient) GetService(name string) (*servingv1.Service, error)

func (*MockKnServingClient) ListRevisions

func (c *MockKnServingClient) ListRevisions(opts ...ListConfig) (*servingv1.RevisionList, error)

func (*MockKnServingClient) ListRoutes

func (c *MockKnServingClient) ListRoutes(opts ...ListConfig) (*servingv1.RouteList, error)

func (*MockKnServingClient) ListServices

func (c *MockKnServingClient) ListServices(opts ...ListConfig) (*servingv1.ServiceList, error)

func (*MockKnServingClient) Namespace

func (c *MockKnServingClient) Namespace() string

Namespace of this client

func (*MockKnServingClient) Recorder

func (c *MockKnServingClient) Recorder() *ServingRecorder

Get the record to start for the recorder

func (*MockKnServingClient) UpdateService

func (c *MockKnServingClient) UpdateService(service *servingv1.Service) error

func (*MockKnServingClient) UpdateServiceWithRetry

func (c *MockKnServingClient) UpdateServiceWithRetry(name string, updateFunc serviceUpdateFunc, maxRetry int) error

Delegate to shared retry method

func (*MockKnServingClient) WaitForService

func (c *MockKnServingClient) WaitForService(name string, timeout time.Duration, msgCallback wait.MessageCallback) (error, time.Duration)

type NoBaseRevisionError

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

func (NoBaseRevisionError) Error

func (e NoBaseRevisionError) Error() string

type ServingRecorder

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

recorder for service

func (*ServingRecorder) CreateService

func (sr *ServingRecorder) CreateService(service interface{}, err error)

Create a new service

func (*ServingRecorder) DeleteRevision

func (sr *ServingRecorder) DeleteRevision(name, timeout interface{}, err error)

Delete a revision

func (*ServingRecorder) DeleteService

func (sr *ServingRecorder) DeleteService(name, timeout interface{}, err error)

Delete a service by name

func (*ServingRecorder) GetConfiguration

func (sr *ServingRecorder) GetConfiguration(name string, config *servingv1.Configuration, err error)

GetConfiguration records a call to GetConfiguration with possible return values

func (*ServingRecorder) GetRevision

func (sr *ServingRecorder) GetRevision(name interface{}, revision *servingv1.Revision, err error)

Get a revision by name

func (*ServingRecorder) GetRoute

func (sr *ServingRecorder) GetRoute(name interface{}, route *servingv1.Route, err error)

Get a route by its unique name

func (*ServingRecorder) GetService

func (sr *ServingRecorder) GetService(name interface{}, service *servingv1.Service, err error)

Get Service

func (*ServingRecorder) ListRevisions

func (sr *ServingRecorder) ListRevisions(opts interface{}, revisionList *servingv1.RevisionList, err error)

List revisions

func (*ServingRecorder) ListRoutes

func (sr *ServingRecorder) ListRoutes(opts interface{}, routeList *servingv1.RouteList, err error)

List routes

func (*ServingRecorder) ListServices

func (sr *ServingRecorder) ListServices(opts interface{}, serviceList *servingv1.ServiceList, err error)

List services

func (*ServingRecorder) UpdateService

func (sr *ServingRecorder) UpdateService(service interface{}, err error)

Update the given service

func (*ServingRecorder) Validate

func (sr *ServingRecorder) Validate()

Check that every recorded method has been called

func (*ServingRecorder) WaitForService

func (sr *ServingRecorder) WaitForService(name interface{}, timeout interface{}, callback interface{}, err error, duration time.Duration)

Wait for a service to become ready, but not longer than provided timeout

Jump to

Keyboard shortcuts

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