testing

package
v44.23.4 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MPL-2.0 Imports: 3 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 *workerproto.Protocol

	// The protocol representing the worker side; register for messages on
	// this to confirm that messages were received
	WorkerProtocol *workerproto.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) FlushMessagesToRunner

func (wkr *FakeWorker) FlushMessagesToRunner()

Return only after all messages to the worker sent before this call have been received

func (*FakeWorker) FlushMessagesToWorker

func (wkr *FakeWorker) FlushMessagesToWorker()

Return only after all messages to the worker sent before this call have been received

func (*FakeWorker) MessageReceivedFunc

func (wkr *FakeWorker) MessageReceivedFunc(msgType string, matcher func(msg workerproto.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 by the worker. This is useful for building assertions. This function flushes all messages sent to the worker before performing its check.

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() (workerproto.Message, bool)

func (*LocalTransport) Send

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

Jump to

Keyboard shortcuts

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