Documentation
¶
Index ¶
- type EndpointExtractor
- func (m *EndpointExtractor) Extract(_ context.Context, event fwkdl.EndpointEvent) error
- func (m *EndpointExtractor) GetEvents() []fwkdl.EndpointEvent
- func (m *EndpointExtractor) Reset()
- func (m *EndpointExtractor) TypedName() fwkplugin.TypedName
- func (m *EndpointExtractor) WithExtractError(err error) *EndpointExtractor
- func (m *EndpointExtractor) WithType(typeName string) *EndpointExtractor
- type Extractor
- func (m *Extractor) CallCount() int
- func (m *Extractor) Extract(_ context.Context, in fwkdl.PollInput[fwkdl.Metrics]) error
- func (m *Extractor) GetCallCount() int
- func (m *Extractor) Reset()
- func (m *Extractor) TypedName() fwkplugin.TypedName
- func (m *Extractor) WithExtractError(err error) *Extractor
- func (m *Extractor) WithMetricsUpdate(metrics *fwkdl.Metrics) *Extractor
- type NotificationExtractor
- func (m *NotificationExtractor) Extract(_ context.Context, event fwkdl.NotificationEvent) error
- func (m *NotificationExtractor) GVK() schema.GroupVersionKind
- func (m *NotificationExtractor) GetEvents() []fwkdl.NotificationEvent
- func (m *NotificationExtractor) Reset()
- func (m *NotificationExtractor) TypedName() fwkplugin.TypedName
- func (m *NotificationExtractor) WithExtractError(err error) *NotificationExtractor
- func (m *NotificationExtractor) WithGVK(gvk schema.GroupVersionKind) *NotificationExtractor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EndpointExtractor ¶
type EndpointExtractor struct {
// contains filtered or unexported fields
}
EndpointExtractor is a mock EndpointExtractor for testing. It records all events it receives and provides helper methods for test assertions.
func NewEndpointExtractor ¶
func NewEndpointExtractor(name string) *EndpointExtractor
NewEndpointExtractor creates a new mock EndpointExtractor with the given name.
func (*EndpointExtractor) Extract ¶
func (m *EndpointExtractor) Extract(_ context.Context, event fwkdl.EndpointEvent) error
Extract records the event and returns any configured error.
func (*EndpointExtractor) GetEvents ¶
func (m *EndpointExtractor) GetEvents() []fwkdl.EndpointEvent
GetEvents returns a copy of all recorded events.
func (*EndpointExtractor) Reset ¶
func (m *EndpointExtractor) Reset()
Reset clears all recorded events.
func (*EndpointExtractor) TypedName ¶
func (m *EndpointExtractor) TypedName() fwkplugin.TypedName
func (*EndpointExtractor) WithExtractError ¶
func (m *EndpointExtractor) WithExtractError(err error) *EndpointExtractor
WithExtractError configures the extractor to return an error on Extract.
func (*EndpointExtractor) WithType ¶
func (m *EndpointExtractor) WithType(typeName string) *EndpointExtractor
WithType overrides the extractor's TypedName().Type for tests that need distinct Types (e.g. covering yield-vs-bind branches in runtime.Configure).
type Extractor ¶
type Extractor struct {
// contains filtered or unexported fields
}
Extractor is a generic mock for the typed Extractor[PollInput[Metrics]] interface used by polling tests. It records call counts and optionally updates endpoint metrics on each Extract.
func NewPollingExtractor ¶
NewPollingExtractor creates a mock extractor for polling data sources. The metrics-typed input matches the HTTPDataSource[Metrics] dispatcher used by polling integration tests.
func (*Extractor) GetCallCount ¶
GetCallCount returns call count (thread-safe).
func (*Extractor) TypedName ¶
Type uses m.name so instances look like distinct plugin types; HTTP source dedupes appends by Type.
func (*Extractor) WithExtractError ¶
WithExtractError configures the extractor to return an error.
type NotificationExtractor ¶
type NotificationExtractor struct {
// contains filtered or unexported fields
}
NotificationExtractor implements both Extractor and NotificationExtractor for testing. It records all events it receives and provides helper methods for test assertions.
func NewNotificationExtractor ¶
func NewNotificationExtractor(name string) *NotificationExtractor
NewNotificationExtractor creates a new mock extractor with the given name.
func (*NotificationExtractor) Extract ¶
func (m *NotificationExtractor) Extract(_ context.Context, event fwkdl.NotificationEvent) error
Extract records the event and returns any configured error.
func (*NotificationExtractor) GVK ¶
func (m *NotificationExtractor) GVK() schema.GroupVersionKind
func (*NotificationExtractor) GetEvents ¶
func (m *NotificationExtractor) GetEvents() []fwkdl.NotificationEvent
GetEvents returns an immutable snapshot of all recorded events. It is safe to call concurrently: the snapshot is copied under the internal lock, so callers can iterate the returned slice without holding any lock and without racing against concurrent ExtractNotification calls.
func (*NotificationExtractor) Reset ¶
func (m *NotificationExtractor) Reset()
Reset clears all recorded events.
func (*NotificationExtractor) TypedName ¶
func (m *NotificationExtractor) TypedName() fwkplugin.TypedName
func (*NotificationExtractor) WithExtractError ¶
func (m *NotificationExtractor) WithExtractError(err error) *NotificationExtractor
WithExtractError configures the extractor to return an error on Extract.
func (*NotificationExtractor) WithGVK ¶
func (m *NotificationExtractor) WithGVK(gvk schema.GroupVersionKind) *NotificationExtractor
WithGVK sets the GVK for the mock extractor.