mock

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package mock provides mocks for pipeline components and allows to execute integration tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter struct {
	Messages int
	Samples  int
	Values   signal.Floating
}

Counter counts messages, samples and can capture sinked values.

type Flusher

type Flusher struct {
	Flushed      bool
	ErrorOnFlush error
}

Flusher allows to mock components hooks.

func (*Flusher) Flush

func (f *Flusher) Flush(context.Context) error

Flush implements pipe.Flusher.

type Mutator

type Mutator struct {
	Mutability mutable.Context
	Mutated    bool
}

Mutator allows to mock mutations.

func (*Mutator) MockMutation

func (m *Mutator) MockMutation() mutable.Mutation

MockMutation mocks mutation, so errors can be simulated.

type Processor

type Processor struct {
	Mutator
	Counter
	Starter
	Flusher
	ErrorOnCall error
	ErrorOnMake error
}

Processor are settings for pipe.Processor mock.

func (*Processor) Processor

func (m *Processor) Processor() pipe.ProcessorAllocatorFunc

Processor returns closure that creates new processors.

type Sink

type Sink struct {
	Mutator
	Counter
	Starter
	Flusher
	Discard     bool
	ErrorOnCall error
	ErrorOnMake error
}

Sink are settings for pipe.Sink mock.

func (*Sink) Sink

func (m *Sink) Sink() pipe.SinkAllocatorFunc

Sink returns closure that creates new sinks.

type Source

type Source struct {
	Mutator
	Counter
	Starter
	Flusher
	Interval    time.Duration
	Limit       int
	Value       float64
	Channels    int
	SampleRate  signal.Frequency
	ErrorOnCall error
	ErrorOnMake error
}

Source are settings for pipe.Source mock.

func (*Source) Reset

func (m *Source) Reset() mutable.Mutation

Reset allows to reset source.

func (*Source) Source

func (m *Source) Source() pipe.SourceAllocatorFunc

Source returns SourceAllocatorFunc.

type Starter added in v0.10.0

type Starter struct {
	Started      bool
	ErrorOnStart error
}

Starter allows to mock components hooks.

func (*Starter) Start added in v0.10.0

func (s *Starter) Start(context.Context) error

Start implements pipe.Flusher.

Jump to

Keyboard shortcuts

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