Version: v0.0.0-...-e652847 Latest Latest

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

Go to latest
Published: Jan 15, 2020 License: MIT Imports: 27 Imported by: 0




This section is empty.


View Source
var DefaultBinaryPaths = make(map[string]string)

DefaultBinaryPaths defines the default paths for the various binaries


This section is empty.


type CmdRunner

type CmdRunner struct {
	Dir     string
	Command string
	Args    []string
	Log     xbus.Logger

CmdRunner can run a command with args

func NewCmdRunner

func NewCmdRunner(log xbus.Logger, dir, command string, args ...string) CmdRunner

NewCmdRunner initializes a CmdRunner

func (CmdRunner) MustRun

func (r CmdRunner) MustRun(args ...string)

MustRun runs the command with args and panic if it fails

func (CmdRunner) Run

func (r CmdRunner) Run(args ...string) error

Run runs the command with args

func (CmdRunner) RunReadAndFindSubmatch

func (r CmdRunner) RunReadAndFindSubmatch(re *regexp.Regexp, args ...string) ([][]string, error)

RunReadAndFindSubmatch runs the command with args, then match each line with the given regex and return the submatches for each

func (CmdRunner) RunReadLastLine

func (r CmdRunner) RunReadLastLine(args ...string) (string, error)

RunReadLastLine runs the command with args and returns the last line of the command combined output

func (CmdRunner) RunReadOutput

func (r CmdRunner) RunReadOutput(args ...string) ([]byte, error)

RunReadOutput returns the command output

type Consumer

type Consumer struct {
	Actor *xbus.Actor

	Envelopes []*api.Envelope
	// contains filtered or unexported fields

Consumer is an emitter actor for FullEnv

func NewConsumer

func NewConsumer(logger xbus.Logger) *Consumer

NewConsumer initializes a Consumer

func (*Consumer) Process

func (c *Consumer) Process(apc *xbus.ActorProcessingContext) error

Process is called by xbus when inputs are ready

func (*Consumer) Service

func (c *Consumer) Service(actor *xbus.Actor) xbus.ActorService

Service is a Actor factory

type CtlSettings

type CtlSettings struct {
	Name     string `yaml:"account-name"`
	Password string

CtlSettings hods options of a ctl

type Emitter

type Emitter struct {
	Actor *xbus.Actor
	// contains filtered or unexported fields

Emitter is an emitter actor for FullEnv

func NewEmitter

func NewEmitter(logger xbus.Logger) *Emitter

NewEmitter initializes a Emitter

func (*Emitter) Service

func (e *Emitter) Service(actor *xbus.Actor) xbus.ActorService

Service is a Actor factory

func (*Emitter) Shutdown

func (e *Emitter) Shutdown() error

Shutdown ...

func (*Emitter) Startup

func (e *Emitter) Startup() error

Startup ...

type FileCopyOption

type FileCopyOption struct {
	Source string
	Target string

FileCopyOption holds options to copy files to the test env

type FileOption

type FileOption struct {
	Copy *FileCopyOption

FileOption holds options to setup files to the test env

type FullEnv

type FullEnv struct {
	XbusCtl CmdRunner
	Xbusd   CmdRunner

	ExtraXbusCtl map[string]CmdRunner

	Emitter  *Emitter
	Consumer *Consumer
	// contains filtered or unexported fields

FullEnv pilots xbusd and clients

func NewFullEnv

func NewFullEnv(basename string, options Options) *FullEnv

NewFullEnv initializes a FullEnv

func NewFullEnvForTest

func NewFullEnvForTest(t *testing.T, basename, configfile string) (*FullEnv, *testutils.TestLogger)

NewFullEnvForTest returns a FullEnv that sends logs to a *testing.T

func (*FullEnv) BinPath

func (fe *FullEnv) BinPath(name string) string

BinPath returns the path of a binary.

func (*FullEnv) ClientConfig

func (fe *FullEnv) ClientConfig(name string) (string, error)

ClientConfig returns the configuration file of a client

func (*FullEnv) Close

func (fe *FullEnv) Close() error

Close stops everything, including the server

func (*FullEnv) CreateEnv

func (fe *FullEnv) CreateEnv() error

CreateEnv creates the test directories, configuration files, setup the XbusCtl and Xbusd command runners. It does not run any command (see Init)

func (*FullEnv) GetClient

func (fe *FullEnv) GetClient(name string) *xbus.Client

GetClient returns the xbus.Client instance corresponding to the inprocess client

func (*FullEnv) GetLogger

func (fe *FullEnv) GetLogger() xbus.Logger

GetLogger returns the environment logger

func (*FullEnv) Init

func (fe *FullEnv) Init() error

Init setup the server, the clients and load the pipelines Once done only the server is running

func (*FullEnv) RegisterActorService

func (fe *FullEnv) RegisterActorService(name string, init xbus.NewActorServiceFunc)

RegisterActorService registers an actor service for this env only Allow to inject actors that are controlled by the test

func (*FullEnv) SetCurrentTest

func (fe *FullEnv) SetCurrentTest(t *testing.T) func()

SetCurrentTest changes the current test and logger. It returns a function that switch back to the original test and logger

func (*FullEnv) SetupCtl

func (fe *FullEnv) SetupCtl() (err error)

SetupCtl runs the commands for setting up a operational XbusCtl

func (*FullEnv) SetupDB

func (fe *FullEnv) SetupDB() error

SetupDB provides an empty database in the database.dsn xbusd setting

func (*FullEnv) SetupFiles

func (fe *FullEnv) SetupFiles() error

SetupFiles copy all the files specified in the 'files' section

func (*FullEnv) SetupInternalActors

func (fe *FullEnv) SetupInternalActors()

SetupInternalActors initializes the fullenv actors

func (*FullEnv) SetupServer

func (fe *FullEnv) SetupServer() error

SetupServer runs the commands for setting up an operational xbusd

func (*FullEnv) Shutdown

func (fe *FullEnv) Shutdown() error

Shutdown stops the programs

func (*FullEnv) StartClient

func (fe *FullEnv) StartClient(name string) error

StartClient starts a client

func (*FullEnv) StartXbusd

func (fe *FullEnv) StartXbusd() error

StartXbusd starts the xbusd server

func (*FullEnv) Startup

func (fe *FullEnv) Startup() error

Startup starts the programs

func (*FullEnv) StopClient

func (fe *FullEnv) StopClient(name string) error

StopClient stops a client

func (*FullEnv) StopXbusd

func (fe *FullEnv) StopXbusd() error

StopXbusd stops the xbusd server

func (*FullEnv) WorkDir

func (fe *FullEnv) WorkDir() string

WorkDir returns the directory where all files are written

type Options

type Options struct {
	Xbusd     RawSettings
	Clients   []RawSettings
	Ctl       []CtlSettings
	HTTP      []RawSettings
	Graphs    map[string]RawSettings
	Pipelines map[string]RawSettings
	Dsn       string

	Vars map[string]string

	// If true, no attempt to prevent concurrent access is done.
	NoDBLock bool

	TargetDir string

	ConfigFilePath string
	Files          []FileOption

	BinaryPaths map[string]string

	Logger xbus.Logger

Options holds all the options necessary to setup a FullEnv

func OptionsFromFile

func OptionsFromFile(configfile string) (Options, error)

OptionsFromFile initialize a Options from a yaml configuration file

type ProgramSettings

type ProgramSettings struct {
	Autostart bool
	Priority  int

ProgramSettings defines how and when to start a program

type RawSettings

type RawSettings yaml.MapSlice

RawSettings holds the raw configuration of a xbus program (xbus, xbus-client...)

Jump to

Keyboard shortcuts

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