mocks

package
v6.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Anything is used where the expectation should not be considered.
	Anything = "mocks.Anything"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChildMessage

type ChildMessage struct {
	Index int
	Msg   streams.Message
}

ChildMessage represents a message forwarded to a child index.

type Pipe

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

Pipe is a mock Pipe.

func NewPipe

func NewPipe(t *testing.T) *Pipe

NewPipe create a new mock Pipe instance.

func (*Pipe) AssertExpectations

func (p *Pipe) AssertExpectations()

AssertExpectations asserts that the expectations were met.

func (*Pipe) Commit

func (p *Pipe) Commit(msg streams.Message) error

Commit commits the current state in the sources.

func (*Pipe) ExpectCommit

func (p *Pipe) ExpectCommit()

ExpectCommit registers an expectation of a Commit on the Pipe.

func (*Pipe) ExpectForward

func (p *Pipe) ExpectForward(k, v interface{})

ExpectForward registers an expectation of a Forward on the Pipe.

func (*Pipe) ExpectForwardToChild

func (p *Pipe) ExpectForwardToChild(k, v interface{}, index int)

ExpectForwardToChild registers an expectation of a ForwardToChild on the Pipe.

func (*Pipe) ExpectMark

func (p *Pipe) ExpectMark(k, v interface{})

ExpectMark registers an expectation of a Mark on the Pipe.

func (*Pipe) Forward

func (p *Pipe) Forward(msg streams.Message) error

Forward queues the data to all processor children in the topology.

func (*Pipe) ForwardToChild

func (p *Pipe) ForwardToChild(msg streams.Message, index int) error

ForwardToChild queues the data to the the given processor(s) child in the topology.

func (*Pipe) Mark

func (p *Pipe) Mark(msg streams.Message) error

Mark indicates that the message has been delt with

func (*Pipe) Messages

func (p *Pipe) Messages() []ChildMessage

Messages gets the queued Messages for each Node.

func (*Pipe) ShouldError

func (p *Pipe) ShouldError()

ShouldError indicates that an error should be returned on the next operation.

type Predicate added in v6.0.3

type Predicate struct {
	mock.Mock
}

Predicate is an autogenerated mock type for the Predicate type

func (*Predicate) Assert added in v6.0.3

func (_m *Predicate) Assert(_a0 streams.Message) (bool, error)

Assert provides a mock function with given fields: _a0

type Source

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

Source is a test source to be used with streams command-level tests. It allows consumption of provided set of messages and counts commits. Once the counted commits reach expected level an exit signal is emitted.

func NewSource

func NewSource(msgs []streams.Message, expectedCommitCount int) *Source

NewSource creates a new test source.

func (*Source) Close

func (s *Source) Close() error

Close closes the Source.

func (*Source) Commit

func (s *Source) Commit(interface{}) error

Commit marks the consumed records as processed. Once the counted commits reach expected level an exit signal is emitted.

func (*Source) Consume

func (s *Source) Consume() (streams.Message, error)

Consume gets the next record from the Source.

func (*Source) Wait

func (s *Source) Wait(timeout time.Duration)

Wait waits until all expected commits are received or a specified timeout occurs.

Jump to

Keyboard shortcuts

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