mocks

package
v3.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminAPIClientFactory

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

AdminAPIClientFactory is a mock implementation of adminapi.ClientFactory.

func NewAdminAPIClientFactory

func NewAdminAPIClientFactory(errorsToReturn map[string]error) *AdminAPIClientFactory

func (*AdminAPIClientFactory) CreateAdminAPIClient

type AdminAPIDiscoverer

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

AdminAPIDiscoverer is a mock implementation of adminapi.Discoverer.

func NewAdminAPIDiscoverer

func NewAdminAPIDiscoverer(apisToReturn sets.Set[adminapi.DiscoveredAdminAPI], errToReturn error) *AdminAPIDiscoverer

func (*AdminAPIDiscoverer) AdminAPIsFromEndpointSlice

func (m *AdminAPIDiscoverer) AdminAPIsFromEndpointSlice(discoveryv1.EndpointSlice) (
	sets.Set[adminapi.DiscoveredAdminAPI],
	error,
)

func (*AdminAPIDiscoverer) AdminAPIsFromEndpointSliceCalledTimes

func (m *AdminAPIDiscoverer) AdminAPIsFromEndpointSliceCalledTimes() int

func (*AdminAPIDiscoverer) GetAdminAPIsForServiceCalledTimes

func (m *AdminAPIDiscoverer) GetAdminAPIsForServiceCalledTimes() int

type AdminAPIHandler

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

AdminAPIHandler is a mock implementation of the Admin API. It only implements the endpoints that are required for the tests.

func NewAdminAPIHandler

func NewAdminAPIHandler(t *testing.T, opts ...AdminAPIHandlerOpt) *AdminAPIHandler

func (*AdminAPIHandler) ServeHTTP

func (m *AdminAPIHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*AdminAPIHandler) WasWorkspaceCreated

func (m *AdminAPIHandler) WasWorkspaceCreated() bool

type AdminAPIHandlerOpt

type AdminAPIHandlerOpt func(h *AdminAPIHandler)

func WithConfigPostError

func WithConfigPostError(errorbody []byte) AdminAPIHandlerOpt

func WithConfigurationHash

func WithConfigurationHash(hash string) AdminAPIHandlerOpt

func WithReady

func WithReady(ready bool) AdminAPIHandlerOpt

func WithVersion

func WithVersion(version string) AdminAPIHandlerOpt

WithVersion sets the version string returned by mocked Kong instance. If version is empty, the default version is used.

func WithWorkspaceExists

func WithWorkspaceExists(exists bool) AdminAPIHandlerOpt

type Dataplane

type Dataplane struct {
	KubernetesObjectReportsEnabled bool
	// Mapping namespace to name to status
	// Note: this will come in useful when implementing
	// https://github.com/Kong/kubernetes-ingress-controller/issues/3793
	// which requires the status to be reported for route objects.
	ObjectsStatuses map[string]map[string]k8sobj.ConfigurationStatus
}

func (Dataplane) AreKubernetesObjectReportsEnabled

func (d Dataplane) AreKubernetesObjectReportsEnabled() bool

func (Dataplane) DeleteObject

func (d Dataplane) DeleteObject(_ client.Object) error

func (Dataplane) KubernetesObjectConfigurationStatus

func (d Dataplane) KubernetesObjectConfigurationStatus(obj client.Object) k8sobj.ConfigurationStatus

func (Dataplane) KubernetesObjectIsConfigured

func (d Dataplane) KubernetesObjectIsConfigured(obj client.Object) bool

func (Dataplane) Listeners

func (Dataplane) ObjectExists

func (d Dataplane) ObjectExists(obj client.Object) (bool, error)

func (Dataplane) UpdateObject

func (d Dataplane) UpdateObject(_ client.Object) error

type EventRecorder

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

EventRecorder is a mock implementation of the k8s.io/client-go/tools/record.EventRecorder interface.

func NewEventRecorder

func NewEventRecorder() *EventRecorder

func (*EventRecorder) AnnotatedEventf

func (r *EventRecorder) AnnotatedEventf(_ runtime.Object, _ map[string]string, eventtype, reason, messageFmt string, args ...interface{})

func (*EventRecorder) Event

func (r *EventRecorder) Event(_ runtime.Object, eventtype, reason, message string)

func (*EventRecorder) Eventf

func (r *EventRecorder) Eventf(_ runtime.Object, eventtype, reason, messageFmt string, args ...interface{})

func (*EventRecorder) Events

func (r *EventRecorder) Events() []string

type Ticker

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

func NewTicker

func NewTicker() *Ticker

func (*Ticker) Add

func (t *Ticker) Add(d time.Duration)

func (*Ticker) Channel

func (t *Ticker) Channel() <-chan time.Time

func (*Ticker) Now

func (t *Ticker) Now() time.Time

func (*Ticker) Reset

func (t *Ticker) Reset(d time.Duration)

func (*Ticker) Stop

func (t *Ticker) Stop()

Jump to

Keyboard shortcuts

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