testcomponents

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 9 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 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 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 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