engine

package
v0.0.0-...-d2d06f5 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2018 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoopStateDurationRecorder

func NoopStateDurationRecorder(stateName string, testName string, d time.Duration, err error)

NoopStateDurationRecorder doesn't do anything! it's the default

func NoopTestDurationRecorder

func NoopTestDurationRecorder(testName string, d time.Duration, err error)

NoopTestDurationRecorder doesn't do anything! it's just the default

func OptionRecordStateDuration

func OptionRecordStateDuration(f StateDurationRecorder) func(e *Engine)

OptionRecordStateDuration allow setting a function to be called to record state durations

func OptionRecordTestDuration

func OptionRecordTestDuration(f TestDurationRecorder) func(e *Engine)

OptionRecordTestDuration allow setting a function to be called to record test durations

Types

type DefaultFactory

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

DefaultFactory contains options and ability to create engines

func NewDefaultFactory

func NewDefaultFactory(eo ...Option) DefaultFactory

NewDefaultFactory initializes a factory

func (DefaultFactory) New

func (d DefaultFactory) New(t Test, opts ...Option) (*Engine, error)

New initializes an engine using this factory, with the given options and decorates the test

type Engine

type Engine struct {
	Test
	// contains filtered or unexported fields
}

Engine decorates a test and contains execution metadata

func NewFromYaml

func NewFromYaml(b []byte, ar actionRegistry, tcr transConsRegistry, f Factory) (*Engine, error)

NewFromYaml can parse a slice of bytes, as yaml, into a test!

func (*Engine) ExecuteState

func (e *Engine) ExecuteState(ctx context.Context) (State, <-chan results.Result)

ExecuteState kicks off a state and keeps track of state execution states

func (*Engine) IsLastState

func (e *Engine) IsLastState() bool

IsLastState checks if there are anymore states

func (Engine) Run

func (e Engine) Run(ctx context.Context) error

Run kicks off a test execution

type Factory

type Factory interface {
	New(t Test, opts ...Option) (*Engine, error)
}

Factory creates new engines!

type FileLoader

type FileLoader struct {
	Dir string
	// contains filtered or unexported fields
}

FileLoader contains information on how /where to load files from

func NewFileLoader

func NewFileLoader(dir string, ar actions.Registry, tcr transConsRegistry, ef Factory) (FileLoader, error)

NewFileLoader creates a file loader

func (FileLoader) Load

func (fl FileLoader) Load(name string) (*Engine, error)

Load the test from the Dir matching the name

type HTTPExecutor

type HTTPExecutor struct {
	Addr string

	Loaders Loaders
}

HTTPExecutor can load tests and execute them through REST interface!

func NewHTTPExecutor

func NewHTTPExecutor(loaders Loaders) (HTTPExecutor, error)

NewHTTPExecutor initializes and creates http executor server

func (HTTPExecutor) Execute

func (he HTTPExecutor) Execute(w http.ResponseWriter, r *http.Request)

Execute a test

func (HTTPExecutor) ListenAndServe

func (he HTTPExecutor) ListenAndServe()

ListenAndServe tests through http REST interface

func (HTTPExecutor) RegisterHandlers

func (he HTTPExecutor) RegisterHandlers()

RegisterHandlers registers all routes

type Loaders

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

Loaders collection of loaders

func NewLoaders

func NewLoaders(ls ...loader) Loaders

NewLoaders creates a new collection of loaders

func (Loaders) Load

func (l Loaders) Load(name string) (*Engine, error)

Load by iterating through all loaders, returning the first one that matches or error

type MemoryLoader

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

MemoryLoader stores engines by identifier

func (*MemoryLoader) Load

func (ml *MemoryLoader) Load(name string) (*Engine, error)

Load an engine based on its name

type Option

type Option func(e *Engine)

Option function allows configuration of an engine instance

type State

type State interface {
	Execute(context.Context, results.Results) <-chan results.Result
	Name() string
}

State is what this engine can execute!

type StateDurationRecorder

type StateDurationRecorder func(stateName string, testName string, d time.Duration, err error)

StateDurationRecorder for recording a duration on a state

type Test

type Test struct {
	Name    string
	States  []State
	Timeout time.Duration
}

Test contains all states and global config and metadata

type TestDurationRecorder

type TestDurationRecorder func(testName string, d time.Duration, err error)

TestDurationRecorder for recording duration on a test execution

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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