mesgtest

package
v0.0.0-...-deecf80 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

View Source
var ErrServiceDoesNotExists = errors.New("service does not exists")

ErrServiceDoesNotExists returned when a service is not exists during service start.

Functions

This section is empty.

Types

type EventListen

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

EventListen holds information about an event listen request.

func (*EventListen) EventFilter

func (l *EventListen) EventFilter() string

EventFilter returns the event name.

func (*EventListen) ServiceID

func (l *EventListen) ServiceID() string

ServiceID returns the id of service that events are emitted from.

type Execute

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

Execute holds information about a task execution.

func (*Execute) Data

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

Data decodes task's input data to out.

func (*Execute) ServiceID

func (e *Execute) ServiceID() string

ServiceID returns the id of service that task executed on.

func (*Execute) Tags

func (e *Execute) Tags() []string

Tags returns the set execution tags for execution.

func (*Execute) Task

func (e *Execute) Task() string

Task returns the executed task's name.

type ResultListen

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

ResultListen holds information about a result listen request.

func (*ResultListen) KeyFilter

func (l *ResultListen) KeyFilter() string

KeyFilter returns the output key name.

func (*ResultListen) ServiceID

func (l *ResultListen) ServiceID() string

ServiceID returns the id of service that results are emitted from.

func (*ResultListen) Tags

func (l *ResultListen) Tags() []string

Tags returns the execution tags filter.

func (*ResultListen) TaskFilter

func (l *ResultListen) TaskFilter() string

TaskFilter returns the task key name.

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) EmitEvent

func (s *Server) EmitEvent(serviceID, event string, data interface{}) error

EmitEvent emits a new event for serviceID with given data.

func (*Server) EmitResult

func (s *Server) EmitResult(serviceID, task, outputKey string, data interface{}, executionTags []string) error

EmitResult emits a new task result for serviceID with given outputKey and data.

func (*Server) LastEventListen

func (s *Server) LastEventListen() <-chan *EventListen

LastEventListen returns the chan that receives last event listen request's info.

func (*Server) LastExecute

func (s *Server) LastExecute() <-chan *Execute

LastExecute returns the chan that receives last task execution's info.

func (*Server) LastResultListen

func (s *Server) LastResultListen() <-chan *ResultListen

LastResultListen returns the chan that receives last result listen request's info.

func (*Server) LastServiceStart

func (s *Server) LastServiceStart() <-chan *ServiceStart

LastServiceStart returns the chan that receives last service start request's info.

func (*Server) MarkServiceAsNonExistent

func (s *Server) MarkServiceAsNonExistent(id string)

MarkServiceAsNonExistent marks a service id as non-exists server.

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 ServiceStart

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

ServiceStart holds information about a service start request.

func (*ServiceStart) ServiceID

func (s *ServiceStart) ServiceID() string

ServiceID returns the started service's id.

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