dsl

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PluginDefNameKey of the PluginDef map
	PluginDefNameKey = "Name"
	// PluginDefDirKey of the PluginDef map
	PluginDefDirKey = "Dir"
	// PluginDefFilenameKey of the PluginDef map
	PluginDefFilenameKey = "Filename"
	// PluginDefParamsKey of the PluginDef map
	PluginDefParamsKey = "Params"
	// PluginDefSeedKey of the PluginDef map
	PluginDefSeedKey = "Seed"
	// PluginDefVerboseKey of the PluginDef map
	PluginDefVerboseKey = "Verbose"
	// PluginDefPriorityKey of the PluginDef map
	PluginDefPriorityKey = "Priority"
	// PluginDefLabelsKey of the PluginDef map
	PluginDefLabelsKey = "Labels"
	// PluginDefTestsKey of the PluginDef map
	PluginDefTestsKey = "Tests"
	// PluginDefLogLevelKey of the PluginDef map
	PluginDefLogLevelKey = "LogLevels"
	// PluginDefListKey of the PluginDef map
	PluginDefListKey = "List"
	// PluginDefEmitJSONKey of the PluginDef map
	PluginDefEmitJSONKey = "EmitJSON"
	// PluginDefNonzeroOnAnyErrorKey of the PluginDef map
	PluginDefNonzeroOnAnyErrorKey = "NonzeroOnAnyErrorKey"
	// PluginDefRetryKey of the PluginDef map
	PluginDefRetryKey = "Retry"
	// PluginDefIncludeDirsKey of the PluginDef map
	PluginDefIncludeDirsKey = "IncludeDirs"
)

Variables

View Source
var ThePluginRegistry = make(PluginRegistry)

ThePluginRegistry is the global, well-know registry of supported plax Plugin types

Functions

This section is empty.

Types

type Ctx

type Ctx struct {
	*plaxDsl.Ctx
}

Ctx is the context type

func NewCtx

func NewCtx(ctx context.Context) *Ctx

NewCtx builds a new Ctx

type IncludeDirList

type IncludeDirList []string

IncludeDirList are the directories to search when YAML-including.

We make an explicit type to enable flag.Var to parse multiple parameters.

func (*IncludeDirList) Set

func (idl *IncludeDirList) Set(value string) error

Set the include directories

func (*IncludeDirList) String

func (idl *IncludeDirList) String() string

String representation

type Plugin

type Plugin interface {
	// Invoke calls the plugin
	Invoke(ctx context.Context) error
}

Plugin interface of invoking plax

func MakePlugin

func MakePlugin(module PluginModule, def PluginDef) (Plugin, error)

MakePlugin create the plugin

type PluginDef

type PluginDef map[string]interface{}

PluginDef map

func (PluginDef) GetPluginDefDir

func (pd PluginDef) GetPluginDefDir() (string, error)

GetPluginDefDir returns the Dir

func (PluginDef) GetPluginDefEmitJSON

func (pd PluginDef) GetPluginDefEmitJSON() (bool, error)

GetPluginDefEmitJSON returns the EmitJSON flag

func (PluginDef) GetPluginDefFilename

func (pd PluginDef) GetPluginDefFilename() (string, error)

GetPluginDefFilename returns the Filename

func (PluginDef) GetPluginDefIncludeDirsKey added in v0.5.3

func (pd PluginDef) GetPluginDefIncludeDirsKey() ([]string, error)

GetPluginDefIncludeDirsKey returns the Includes list

func (PluginDef) GetPluginDefLabels

func (pd PluginDef) GetPluginDefLabels() (string, error)

GetPluginDefLabels returns the Labels

func (PluginDef) GetPluginDefList

func (pd PluginDef) GetPluginDefList() (bool, error)

GetPluginDefList returns the List flag

func (PluginDef) GetPluginDefLogLevel

func (pd PluginDef) GetPluginDefLogLevel() (string, error)

GetPluginDefLogLevel returns the Filename

func (PluginDef) GetPluginDefName

func (pd PluginDef) GetPluginDefName() (string, error)

GetPluginDefName returns the Name

func (PluginDef) GetPluginDefNonzeroOnAnyErrorKey

func (pd PluginDef) GetPluginDefNonzeroOnAnyErrorKey() (bool, error)

GetPluginDefNonzeroOnAnyErrorKey returns the EmitJSON flag

func (PluginDef) GetPluginDefParams

func (pd PluginDef) GetPluginDefParams() (map[string]interface{}, error)

GetPluginDefParams returns the Params

func (PluginDef) GetPluginDefPriority

func (pd PluginDef) GetPluginDefPriority() (int, error)

GetPluginDefPriority returns the Priority

func (PluginDef) GetPluginDefRetry

func (pd PluginDef) GetPluginDefRetry() (string, error)

GetPluginDefRetry returns the Retry

func (PluginDef) GetPluginDefSeed

func (pd PluginDef) GetPluginDefSeed() (int64, error)

GetPluginDefSeed returns the Seed

func (PluginDef) GetPluginDefTests

func (pd PluginDef) GetPluginDefTests() ([]string, error)

GetPluginDefTests returns the list of test to run

func (PluginDef) GetPluginDefVerbose

func (pd PluginDef) GetPluginDefVerbose() (bool, error)

GetPluginDefVerbose returns the Filename

type PluginMaker

type PluginMaker func(def PluginDef) (Plugin, error)

PluginMaker is the signature for a Plugin constructor

type PluginModule

type PluginModule string

PluginModule identifies the plax plugin by module name

var (
	// DefaultPluginModule to load; "There can be only one!"
	DefaultPluginModule PluginModule = "github.com/Comcast/plax"
)

type PluginOpts

type PluginOpts interface{}

PluginOpts represents generic data that is given to a plugin

type PluginRegistry

type PluginRegistry map[PluginModule]PluginMaker

PluginRegistry maps a PluginModule to a constructor for that type of Plugin

func (PluginRegistry) Register

func (pr PluginRegistry) Register(module PluginModule, maker PluginMaker)

Register registers a plugin

type TestConstraints

type TestConstraints struct {
	Labels   *string      `yaml:"labels,omitempty"`
	Priority *int         `yaml:"priority,omitempty"`
	Retry    int          `yaml:"retry"`
	Seed     int64        `yaml:"seed"`
	Iterate  *TestIterate `yaml:"iterate,omitempty"`
}

TestConstraints used to constrain the tests run

type TestDef

type TestDef struct {
	Path   string                  `yaml:"path"`
	Module PluginModule            `yaml:"version"`
	Params TestParamDependencyList `yaml:"params"`
}

TestDef is a test file or suite (directory)

type TestDefMap

type TestDefMap map[string]TestDef

TestDefMap is a map of TestDefs

type TestDefRef

type TestDefRef struct {
	TestConstraints `yaml:",inline"`
	Name            string       `yaml:"name"`
	Params          TestParamMap `yaml:"params"`
	Guard           *TestGuard   `yaml:"guard,omitempty"`
	// contains filtered or unexported fields
}

TestDefRef references a TestDef with its constraints

type TestDefRefList

type TestDefRefList []TestDefRef

TestDefRefList is a list of TestDefRefs

type TestGroup

type TestGroup struct {
	Iterate *TestIterate     `yaml:"iterate,omitempty"`
	Params  TestParamMap     `yaml:"params"`
	Tests   TestDefRefList   `yaml:"tests"`
	Groups  TestGroupRefList `yaml:"groups"`
}

TestGroup is a set of grouped tests or nested groups

type TestGroupList

type TestGroupList []string

TestGroupList are the test groups to execute

We make an explicit type to enable flag.Var to parse multiple parameters.

func (*TestGroupList) Set

func (tgl *TestGroupList) Set(value string) error

Set the groups

func (*TestGroupList) String

func (tgl *TestGroupList) String() string

String representation

type TestGroupMap

type TestGroupMap map[string]TestGroup

TestGroupMap is a map of TestGroups

type TestGroupRef

type TestGroupRef struct {
	Name   string       `yaml:"name"`
	Params TestParamMap `yaml:"params"`
	Guard  *TestGuard   `yaml:"guard,omitempty"`
}

TestGroupRef references a group by name

type TestGroupRefList

type TestGroupRefList []TestGroupRef

TestGroupRefList is a list of TestGroupRefs

type TestGuard

type TestGuard struct {
	// Libraries is a list of filenames that should contain
	// Javascript.  This source is loaded into each Javascript
	// environment.
	DependsOn TestParamDependencyList `yaml:"dependsOn"`
	Libraries []string                `yaml:"libraries"`
	Source    string                  `yaml:"src"`
}

TestGuard for guarding tests, groups, or iterations

func (*TestGuard) Satisfied

func (tg *TestGuard) Satisfied(ctx *plaxDsl.Ctx, tr TestRun, bs *plaxDsl.Bindings) (bool, error)

Satisfied checks if the guard allows the test to be executed

type TestIterate

type TestIterate struct {
	DependsOn TestParamDependencyList `yaml:"dependsOn"`
	Param     *string                 `yaml:"param"`
	Params    string                  `yaml:"params"`
	Guard     *TestGuard              `yaml:"guard,omitempty"`
}

TestIterate is used to iterate over a collection and invoke the test suite or test file multiple times

type TestIterateBindings

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

TestIterateBindings is the bindings for an iteration

type TestIterateBindingsList

type TestIterateBindingsList []TestIterateBindings

TestIterateBindingsList is a list of test iteration bindings

type TestList

type TestList []string

TestList are the individual tests to execute

We make an explicit type to enable flag.Var to parse multiple parameters.

func (*TestList) Set

func (tl *TestList) Set(value string) error

Set the test in the testList

func (*TestList) String

func (tl *TestList) String() string

String representation

type TestParamBinding

type TestParamBinding struct {
	// DependsOn is a list of dependent parameters
	DependsOn TestParamDependencyList `json:"dependsOn" yaml:"dependsOn"`

	// Cmd is the command name of the program.
	//
	// Subject to expansion.
	Cmd string `json:"cmd" yaml:"cmd"`

	// Args is the list of command-line arguments for the program.
	//
	// Subject to expansion.
	Args []string `json:"args" yaml:"args"`

	// tpem is the map of environment variables to pass into the Run script
	Envs TestParamEnvMap `json:"envs" yaml:"envs"`
	// contains filtered or unexported fields
}

TestParamBinding binds a value to a parameter via a command

type TestParamBindingMap

type TestParamBindingMap map[string]TestParamBinding

TestParamBindingMap is a map of TestParamBinding

type TestParamDependency

type TestParamDependency string

TestParamDependency name

type TestParamDependencyList

type TestParamDependencyList []TestParamDependency

TestParamDependencyList parameter dependency list

type TestParamEnvMap

type TestParamEnvMap map[string]string

TestParamEnvMap type

type TestParamMap

type TestParamMap map[string]string

TestParamMap of parameter keys to non substituted parameter values

type TestRun

type TestRun struct {
	Name    string              `yaml:"name"`
	Version string              `yaml:"version"`
	Tests   TestDefMap          `yaml:"tests"`
	Groups  TestGroupMap        `yaml:"groups"`
	Params  TestParamBindingMap `yaml:"params"`
	// contains filtered or unexported fields
}

TestRun is the top-level type for a test run.

func NewTestRun

func NewTestRun(ctx *Ctx, trps *TestRunParams) (*TestRun, error)

NewTestRun makes a new TestRun with the given TestRunParams

func (*TestRun) Exec

func (tr *TestRun) Exec(ctx *Ctx) error

Exec the TestRun

type TestRunParams

type TestRunParams struct {
	Bindings    plaxDsl.Bindings
	Groups      TestGroupList
	Tests       TestList
	SuiteName   *string
	IncludeDirs IncludeDirList
	Filename    *string
	Dir         *string
	EmitJSON    *bool
	Verbose     *bool
	LogLevel    *string
	Labels      *string
	Priority    *int
}

TestRunParams used to exec a TestRun

type TestSuiteRef

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

TestSuiteRef reference

Jump to

Keyboard shortcuts

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