testing

package
v28.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLocalTransportPair

func NewLocalTransportPair() (*LocalTransport, *LocalTransport)

Create a linked pair of LocalTransport instances. This is similar to the POSIX pipe() method.

Types

type FakeWorker

type FakeWorker struct {
	// The protocol with which to communicate with this worker.  Use this
	// as a protocol for testing worker-runner.
	RunnerProtocol *protocol.Protocol

	// The protocol representing the worker side; register for messages on
	// this to confirm that messages were received
	WorkerProtocol *protocol.Protocol
	// contains filtered or unexported fields
}

FakeWorker implements a fake worker, in terms of the protocol at least

func NewFakeWorkerWithCapabilities

func NewFakeWorkerWithCapabilities(capabilities ...string) *FakeWorker

Create a new fake worker with the given capabilities. The worker side of this protocol is started, but the runner side is not -- that is up to the caller.

func (*FakeWorker) Close

func (wkr *FakeWorker) Close()

Close down the fake worker. Call this to dispose of resources.

func (*FakeWorker) MessageReceivedFunc

func (wkr *FakeWorker) MessageReceivedFunc(msgType string, matcher func(msg protocol.Message) bool) func() bool

Generate a function that can be called to assert that message of the given type has or has not been received. This is useful for building assertions.

type LocalTransport

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

LocalTransport is a transport for which both sides are in the same process.

func (*LocalTransport) Close

func (transp *LocalTransport) Close()

func (*LocalTransport) Recv

func (transp *LocalTransport) Recv() (protocol.Message, bool)

func (*LocalTransport) Send

func (transp *LocalTransport) Send(msg protocol.Message)

Jump to

Keyboard shortcuts

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