testcomponents

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package testcomponents contains components useful for testing. They are not intended to be exposed by end users and so this package should only be imported in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Community added in v1.3.0

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

Community is a test community component.

func (*Community) Run added in v1.3.0

func (e *Community) Run(ctx context.Context) error

func (*Community) Update added in v1.3.0

func (e *Community) Update(args component.Arguments) error

type Count

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

func NewCount

func NewCount(o component.Options, cfg CountConfig) (*Count, error)

func (*Count) Run

func (t *Count) Run(ctx context.Context) error

func (*Count) Update

func (t *Count) Update(args component.Arguments) error

Update implements Component.

type CountConfig

type CountConfig struct {
	Frequency time.Duration `alloy:"frequency,attr"`
	Max       int           `alloy:"max,attr"`
}

type CountExports

type CountExports struct {
	Count int `alloy:"count,attr,optional"`
}

type Experimental

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

Experimental is a test component that is marked as experimental. Used to verify stability level checking.

func (*Experimental) Run

func (e *Experimental) Run(ctx context.Context) error

func (*Experimental) Update

func (e *Experimental) Update(args component.Arguments) error

type Fake

type Fake struct {
	RunFunc    func(ctx context.Context) error
	UpdateFunc func(args component.Arguments) error
}

Fake is a fake component instance which invokes fields when its methods are called. Fake does not register itself as a component and must be provided in a custom registry.

The zero value is ready for use.

func (*Fake) Run

func (f *Fake) Run(ctx context.Context) error

Run implements component.Component. f.RunFunc will be invoked if it is non-nil, otherwise a default implementation is used.

func (*Fake) Update

func (f *Fake) Update(args component.Arguments) error

Update implements component.Component. f.UpdateFunc will be invoked if it is non-nil, otherwise a default implementation is used.

type IntReceiver added in v1.7.0

type IntReceiver interface {
	ReceiveInt(int)
}

type IntReceiverImpl added in v1.7.0

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

func (IntReceiverImpl) ReceiveInt added in v1.7.0

func (r IntReceiverImpl) ReceiveInt(i int)

type Passthrough

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

Passthrough implements the testcomponents.passthrough component, where it always emits its input as an output.

func NewPassthrough

func NewPassthrough(o component.Options, cfg PassthroughConfig) (*Passthrough, error)

NewPassthrough creates a new passthrough component.

func (*Passthrough) DebugInfo

func (t *Passthrough) DebugInfo() interface{}

DebugInfo implements DebugComponent.

func (*Passthrough) Run

func (t *Passthrough) Run(ctx context.Context) error

Run implements Component.

func (*Passthrough) Update

func (t *Passthrough) Update(args component.Arguments) error

Update implements Component.

type PassthroughConfig

type PassthroughConfig struct {
	Input string        `alloy:"input,attr"`
	Lag   time.Duration `alloy:"lag,attr,optional"`
}

PassthroughConfig configures the testcomponents.passthrough component.

type PassthroughExports

type PassthroughExports struct {
	Output string `alloy:"output,attr,optional"`
}

PassthroughExports describes exported fields for the testcomponents.passthrough component.

type Pulse added in v1.7.0

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

func NewPulse added in v1.7.0

func NewPulse(o component.Options, cfg PulseConfig) (*Pulse, error)

func (*Pulse) Run added in v1.7.0

func (p *Pulse) Run(ctx context.Context) error

func (*Pulse) Update added in v1.7.0

func (t *Pulse) Update(args component.Arguments) error

Update implements Component.

type PulseConfig added in v1.7.0

type PulseConfig struct {
	Frequency time.Duration `alloy:"frequency,attr"`
	Max       int           `alloy:"max,attr"`
	ForwardTo []IntReceiver `alloy:"forward_to,attr,optional"`
}

type StringReceiver added in v1.7.0

type StringReceiver interface {
	Receive(string)
}

type StringReceiverComponent added in v1.7.0

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

func NewStringReceiverComp added in v1.7.0

func NewStringReceiverComp(o component.Options, cfg StringReceiverConfig) (*StringReceiverComponent, error)

NewStringReceiver creates a new string_receiver component.

func (*StringReceiverComponent) DebugInfo added in v1.7.0

func (s *StringReceiverComponent) DebugInfo() interface{}

Return the receiver as debug info instead of export to avoid evaluation loop.

func (*StringReceiverComponent) Run added in v1.7.0

Run implements Component.

func (*StringReceiverComponent) Update added in v1.7.0

Update implements Component.

type StringReceiverConfig added in v1.7.0

type StringReceiverConfig struct {
}

type StringReceiverExports added in v1.7.0

type StringReceiverExports struct {
	Receiver StringReceiver `alloy:"receiver,attr"`
}

type StringReceiverImpl added in v1.7.0

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

func (StringReceiverImpl) Receive added in v1.7.0

func (r StringReceiverImpl) Receive(s string)

type Stringer added in v1.7.0

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

func NewStringer added in v1.7.0

func NewStringer(o component.Options, cfg StringerConfig) (*Stringer, error)

func (*Stringer) Run added in v1.7.0

func (s *Stringer) Run(ctx context.Context) error

func (*Stringer) Update added in v1.7.0

func (s *Stringer) Update(args component.Arguments) error

Update implements Component.

type StringerConfig added in v1.7.0

type StringerConfig struct {
	InputString *string          `alloy:"input_string,attr,optional"`
	InputInt    *int             `alloy:"input_int,attr,optional"`
	InputFloat  *float64         `alloy:"input_float,attr,optional"`
	InputBool   *bool            `alloy:"input_bool,attr,optional"`
	InputMap    *map[string]any  `alloy:"input_map,attr,optional"`
	InputArray  *[]any           `alloy:"input_array,attr,optional"`
	ForwardTo   []StringReceiver `alloy:"forward_to,attr"`
}

type Summation

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

func NewSummation

func NewSummation(o component.Options, cfg SummationConfig) (*Summation, error)

NewSummation creates a new summation component.

func (*Summation) Run

func (t *Summation) Run(ctx context.Context) error

Run implements Component.

func (*Summation) Update

func (t *Summation) Update(args component.Arguments) error

Update implements Component.

type SummationConfig

type SummationConfig struct {
	Input int `alloy:"input,attr"`
}

type SummationExports

type SummationExports struct {
	Sum       int `alloy:"sum,attr"`
	LastAdded int `alloy:"last_added,attr"`
}

type SummationReceiver added in v1.7.0

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

func NewSummationReceiver added in v1.7.0

func NewSummationReceiver(o component.Options, cfg SummationReceiverConfig) (*SummationReceiver, error)

NewSummationReceiver creates a new summation component.

func (*SummationReceiver) DebugInfo added in v1.7.0

func (s *SummationReceiver) DebugInfo() interface{}

Return the sum as debug info instead of export to avoid evaluation loop.

func (*SummationReceiver) Run added in v1.7.0

func (s *SummationReceiver) Run(ctx context.Context) error

Run implements Component.

func (*SummationReceiver) Update added in v1.7.0

func (s *SummationReceiver) Update(args component.Arguments) error

Update implements Component.

type SummationReceiverConfig added in v1.7.0

type SummationReceiverConfig struct {
}

type SummationReceiverExports added in v1.7.0

type SummationReceiverExports struct {
	Receiver IntReceiver `alloy:"receiver,attr"`
}

type Tick

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

Tick implements the testcomponents.tick component, where the wallclock time will be emitted on a given frequency.

func NewTick

func NewTick(o component.Options, cfg TickConfig) (*Tick, error)

NewTick creates a new testcomponents.tick component.

func (*Tick) Run

func (t *Tick) Run(ctx context.Context) error

Run implements Component.

func (*Tick) Update

func (t *Tick) Update(args component.Arguments) error

Update implements Component.

type TickConfig

type TickConfig struct {
	Frequency time.Duration `alloy:"frequency,attr"`
}

TickConfig configures the testcomponents.tick component.

type TickExports

type TickExports struct {
	Time time.Time `alloy:"tick_time,attr,optional"`
}

TickExports describes exported fields for the testcomponents.tick component.

Directories

Path Synopsis
git
Package git implements the module.git component.
Package git implements the module.git component.

Jump to

Keyboard shortcuts

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