v0.0.0-...-1e6772d Latest Latest

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

Go to latest
Published: Aug 21, 2018 License: Apache-2.0 Imports: 7 Imported by: 0



Package mesgtest is a testing package for MESG service. Use this package while unit testing your programs.



This section is empty.


This section is empty.


This section is empty.


type ErrConnectionClosed

type ErrConnectionClosed struct{}

ErrConnectionClosed returned when the connection closed between go-service and server.

func (ErrConnectionClosed) Error

func (e ErrConnectionClosed) Error() string

type Event

type Event struct {
	// contains filtered or unexported fields

Event represents a testing event.

func (*Event) Data

func (e *Event) Data(out interface{}) error

Data decodes event data to out.

func (*Event) Name

func (e *Event) Name() string

Name returns the name of event.

func (*Event) Token

func (e *Event) Token() string

Token returns the service id of service emitted the event.

type Execution

type Execution struct {
	// contains filtered or unexported fields

Execution is a testing task execution result.

func (*Execution) Data

func (e *Execution) Data(out interface{}) error

Data decodes task output to out.

func (*Execution) ID

func (e *Execution) ID() string

ID returns the execution id of task.

func (*Execution) Key

func (e *Execution) Key() string

Key returns the output key of task.

type Server

type Server struct {
	// contains filtered or unexported fields

Server is a test server.

func NewServer

func NewServer() *Server

NewServer creates a new test server.

func (*Server) Close

func (s *Server) Close() error

Close closes test server.

func (*Server) Execute

func (s *Server) Execute(task string, data interface{}) (string, *Execution, error)

Execute executes a task with data.

func (*Server) LastEmit

func (s *Server) LastEmit() chan *Event

LastEmit returns the chan that receives last emitted event's info.

func (*Server) ListenToken

func (s *Server) ListenToken() string

ListenToken returns the token of service that started listening for tasks.

func (*Server) Socket

func (s *Server) Socket() *Socket

Socket returns a in-memory socket for client application.

func (*Server) Start

func (s *Server) Start() error

Start starts the test server.

type Socket

type Socket struct {
	// contains filtered or unexported fields

Socket is an in-memory gRPC socket.

func (*Socket) Dial

func (s *Socket) Dial() (net.Conn, error)

Dial returns the client side net conn.

Jump to

Keyboard shortcuts

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