modetest

package
v5.5.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsyncClients

func AsyncClients(n int, tmpl *MockClient) []mode.AsyncProtocolClient

func AsyncPublishCollect

func AsyncPublishCollect(
	collected *[][]outputs.Data,
) func(func([]outputs.Data, error), []outputs.Data) error

func AsyncPublishCollectAfterFailStart

func AsyncPublishCollectAfterFailStart(
	n int,
	collected *[][]outputs.Data,
) func(func([]outputs.Data, error), []outputs.Data) error

func AsyncPublishCollectAfterFailStartWith

func AsyncPublishCollectAfterFailStartWith(
	n int,
	err error,
	collected *[][]outputs.Data,
) func(func([]outputs.Data, error), []outputs.Data) error

func AsyncPublishFailStart

func AsyncPublishFailStart(
	n int,
	pub func(func([]outputs.Data, error), []outputs.Data) error,
) func(func([]outputs.Data, error), []outputs.Data) error

func AsyncPublishFailStartWith

func AsyncPublishFailStartWith(
	n int,
	err error,
	pub func(func([]outputs.Data, error), []outputs.Data) error,
) func(func([]outputs.Data, error), []outputs.Data) error

func AsyncPublishIgnore

func AsyncPublishIgnore(func([]outputs.Data, error), []outputs.Data) error

func CloseOK

func CloseOK() error

func ConnectFail

func ConnectFail(err error) func(time.Duration) error

func ConnectFailN

func ConnectFailN(n int, err error) func(time.Duration) error

func ConnectOK

func ConnectOK(timeout time.Duration) error

func EventsList

func EventsList(in []EventInfo) [][]outputs.Data

func FlatEventsList

func FlatEventsList(in []EventInfo) []outputs.Data

func FlattenEvents

func FlattenEvents(data [][]outputs.Data) []outputs.Data

func PublishAllWith

func PublishAllWith(
	t *testing.T,
	mode mode.ConnectionMode,
	data []EventInfo,
) ([]bool, [][]outputs.Data)

func PublishCollect

func PublishCollect(
	collected *[][]outputs.Data,
) func(data []outputs.Data) ([]outputs.Data, error)

func PublishCollectAfterFailStart

func PublishCollectAfterFailStart(
	n int,
	collected *[][]outputs.Data,
) func(data []outputs.Data) ([]outputs.Data, error)

func PublishCollectAfterFailStartWith

func PublishCollectAfterFailStartWith(
	n int,
	err error,
	collected *[][]outputs.Data,
) func(data []outputs.Data) ([]outputs.Data, error)

func PublishFailStart

func PublishFailStart(
	n int,
	pub func(data []outputs.Data) ([]outputs.Data, error),
) func(data []outputs.Data) ([]outputs.Data, error)

func PublishFailWith

func PublishFailWith(
	n int,
	err error,
	pub func([]outputs.Data) ([]outputs.Data, error),
) func([]outputs.Data) ([]outputs.Data, error)

func PublishIgnore

func PublishIgnore([]outputs.Data) ([]outputs.Data, error)

func PublishWith

func PublishWith(
	t *testing.T,
	mode mode.ConnectionMode,
	opts outputs.Options,
	data []EventInfo,
	expectedSignals []bool,
) ([]bool, [][]outputs.Data)

func Signals

func Signals(s ...bool) []bool

func SyncClients

func SyncClients(n int, tmpl *MockClient) []mode.ProtocolClient

func TestMode

func TestMode(
	t *testing.T,
	mode mode.ConnectionMode,
	opts outputs.Options,
	data []EventInfo,
	expectedSignals []bool,
	collected *[][]outputs.Data,
)

Types

type EventInfo

type EventInfo struct {
	Single bool
	Data   []outputs.Data
}

func MultiEvent

func MultiEvent(n int, event common.MapStr) []EventInfo

func Repeat

func Repeat(n int, evt []EventInfo) []EventInfo

func SingleEvent

func SingleEvent(e common.MapStr) []EventInfo

type MockClient

type MockClient struct {
	Connected      bool
	CBPublish      func([]outputs.Data) ([]outputs.Data, error)
	CBAsyncPublish func(func([]outputs.Data, error), []outputs.Data) error
	CBClose        func() error
	CBConnect      func(time.Duration) error
}

func NewMockClient

func NewMockClient(template *MockClient) *MockClient

func (*MockClient) AsyncPublishEvent

func (c *MockClient) AsyncPublishEvent(cb func(error), data outputs.Data) error

func (*MockClient) AsyncPublishEvents

func (c *MockClient) AsyncPublishEvents(cb func([]outputs.Data, error), data []outputs.Data) error

func (*MockClient) Close

func (c *MockClient) Close() error

func (*MockClient) Connect

func (c *MockClient) Connect(timeout time.Duration) error

func (*MockClient) PublishEvent

func (c *MockClient) PublishEvent(data outputs.Data) error

func (*MockClient) PublishEvents

func (c *MockClient) PublishEvents(data []outputs.Data) ([]outputs.Data, error)

Jump to

Keyboard shortcuts

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