fault

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInjectedDrop = errors.New("injected request drop")

Functions

This section is empty.

Types

type Injector

type Injector struct {
	Underlying driver.Driver

	Latency             time.Duration
	DropNextN           int
	CorruptNextResponse bool
	HalfOpenDuration    time.Duration
	RotateFaultModes    bool
	// contains filtered or unexported fields
}

Injector wraps a driver.Driver and applies configurable faults for tests.

func Wrap

func Wrap(d driver.Driver) *Injector

func (*Injector) Connect

func (f *Injector) Connect(ctx context.Context) error

func (*Injector) Disconnect

func (f *Injector) Disconnect() error

func (*Injector) GetConnectionMetrics

func (f *Injector) GetConnectionMetrics() (int64, int64, string, string, time.Time)

func (*Injector) Health

func (f *Injector) Health() driver.HealthStatus

func (*Injector) Init

func (f *Injector) Init(cfg model.DriverConfig) error

func (*Injector) ReadPoints

func (f *Injector) ReadPoints(ctx context.Context, points []model.Point) (map[string]model.Value, error)

func (*Injector) SetDeviceConfig

func (f *Injector) SetDeviceConfig(config map[string]any) error

func (*Injector) SetSlaveID

func (f *Injector) SetSlaveID(slaveID uint8) error

func (*Injector) WritePoint

func (f *Injector) WritePoint(ctx context.Context, point model.Point, value any) error

Jump to

Keyboard shortcuts

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