sensetest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sensetest provides a scriptable fake sensor for testing code that drives sensors (the registry, the runner, the pipeline) without a real host.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Factory

func Factory(f *Fake) sense.Factory

Factory returns a factory that always yields f.

func Info

func Info(name string) sense.Info

Info returns a valid sense.Info with the given name, for terse tests.

func Observation

func Observation(key string) evidence.Observation

Observation returns a valid observed `present` observation for tests.

Types

type Fake

type Fake struct {
	SensorInfo sense.Info
	DetectFn   func(context.Context) (bool, error)
	CollectFn  func(context.Context) (evidence.Batch, error)
}

Fake is a sensor whose behaviour is set by its fields. Nil funcs behave as "present, nothing found".

func (*Fake) Collect

func (f *Fake) Collect(ctx context.Context) (evidence.Batch, error)

Collect implements sense.Sensor.

func (*Fake) Detect

func (f *Fake) Detect(ctx context.Context) (bool, error)

Detect implements sense.Sensor.

func (*Fake) Info

func (f *Fake) Info() sense.Info

Info implements sense.Sensor.

Jump to

Keyboard shortcuts

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