mocks

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricsDataSource

type MetricsDataSource struct {
	CallCount int64
	// contains filtered or unexported fields
}

MetricsDataSource is a test PollingDispatcher: on Dispatch it writes the preconfigured metrics into the endpoint and returns a sentinel error. The sentinel signals "test dispatch ran" without producing real Poll data.

func NewDataSource

func NewDataSource(typedName plugin.TypedName) *MetricsDataSource

func (*MetricsDataSource) AppendExtractor

func (fds *MetricsDataSource) AppendExtractor(_ plugin.Plugin) error

AppendExtractor is a no-op: this mock sets endpoint metrics directly in Dispatch instead of running extractors.

func (*MetricsDataSource) Dispatch

func (fds *MetricsDataSource) Dispatch(_ context.Context, ep fwkdl.Endpoint) error

Dispatch satisfies PollingDispatcher. Preserves the original mock side effect (write metrics into the endpoint when keyed by NamespacedName) and returns the sentinel error so tests can detect the dispatch ran.

func (*MetricsDataSource) SetErrors

func (fds *MetricsDataSource) SetErrors(errors map[types.NamespacedName]error)

SetErrors replaces the errors map in a thread-safe manner.

func (*MetricsDataSource) SetMetrics

func (fds *MetricsDataSource) SetMetrics(metrics map[types.NamespacedName]*fwkdl.Metrics)

SetMetrics replaces the metrics map in a thread-safe manner.

func (*MetricsDataSource) TypedName

func (fds *MetricsDataSource) TypedName() plugin.TypedName

type NotificationSource

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

NotificationSource implements DataSource + NotificationSource for testing.

func NewNotificationSource

func NewNotificationSource(pluginType, name string, gvk schema.GroupVersionKind) *NotificationSource

func (*NotificationSource) Collect

func (*NotificationSource) Extractors

func (m *NotificationSource) Extractors() []string

func (*NotificationSource) GVK

func (*NotificationSource) Notify

func (*NotificationSource) TypedName

func (m *NotificationSource) TypedName() plugin.TypedName

Jump to

Keyboard shortcuts

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