test

package
v2.0.0-preview6 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package test provides re-usable functions for binding tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BenchmarkSendReceive

func BenchmarkSendReceive(b *testing.B, s protocol.Sender, r protocol.Receiver)

Simple send/receive benchmark. Requires a sender and receiver that are connected to each other.

func SendReceive

func SendReceive(t *testing.T, ctx context.Context, in binding.Message, s protocol.Sender, r protocol.Receiver, outAssert func(binding.Message))

SendReceive does s.Send(in), then it receives the message in r.Receive() and executes outAssert Halt test on error.

Types

type ChanReceiver

type ChanReceiver <-chan binding.Message

ChanReceiver implements Receiver by receiving Messages from a channel.

func (ChanReceiver) Close

func (r ChanReceiver) Close(ctx context.Context) error

func (ChanReceiver) Receive

func (r ChanReceiver) Receive(ctx context.Context) (binding.Message, error)

type ChanRequester

type ChanRequester struct {
	Ch    chan<- binding.Message
	Reply func(message binding.Message) (binding.Message, error)
}

func (*ChanRequester) Close

func (s *ChanRequester) Close(ctx context.Context) (err error)

func (*ChanRequester) Request

func (s *ChanRequester) Request(ctx context.Context, m binding.Message) (res binding.Message, err error)

func (*ChanRequester) Send

func (s *ChanRequester) Send(ctx context.Context, m binding.Message) (err error)

type ChanResponder

type ChanResponder struct {
	In  <-chan binding.Message
	Out chan<- ChanResponderResponse
}

ChanResponder implements Responder by receiving Messages from a channel and outputting the result in an output channel.

func (*ChanResponder) Close

func (r *ChanResponder) Close(ctx context.Context) error

func (*ChanResponder) Receive

func (r *ChanResponder) Receive(ctx context.Context) (binding.Message, error)

func (*ChanResponder) Respond

type ChanResponderResponse

type ChanResponderResponse struct {
	Message binding.Message
	Result  protocol.Result
}

type ChanSender

type ChanSender chan<- binding.Message

ChanSender implements Sender by sending Messages on a channel.

func (ChanSender) Close

func (s ChanSender) Close(ctx context.Context) (err error)

func (ChanSender) Send

func (s ChanSender) Send(ctx context.Context, m binding.Message) (err error)

Jump to

Keyboard shortcuts

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