Documentation
¶
Overview ¶
* Copyright 2021 Comcast Cable Communications Management, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- Variables
- type Ctx
- type IncludeDirList
- type Plugin
- type PluginDef
- func (pd PluginDef) GetPluginDefDir() (string, error)
- func (pd PluginDef) GetPluginDefFilename() (string, error)
- func (pd PluginDef) GetPluginDefIncludeDirsKey() ([]string, error)
- func (pd PluginDef) GetPluginDefLabels() (string, error)
- func (pd PluginDef) GetPluginDefList() (bool, error)
- func (pd PluginDef) GetPluginDefLogLevel() (string, error)
- func (pd PluginDef) GetPluginDefName() (string, error)
- func (pd PluginDef) GetPluginDefNonzeroOnAnyErrorKey() (bool, error)
- func (pd PluginDef) GetPluginDefParams() (map[string]interface{}, error)
- func (pd PluginDef) GetPluginDefPriority() (int, error)
- func (pd PluginDef) GetPluginDefRedact() (bool, error)
- func (pd PluginDef) GetPluginDefRetry() (string, error)
- func (pd PluginDef) GetPluginDefSeed() (int64, error)
- func (pd PluginDef) GetPluginDefTests() ([]string, error)
- func (pd PluginDef) GetPluginDefVerbose() (bool, error)
- type PluginMaker
- type PluginModule
- type PluginOpts
- type PluginRegistry
- type TestConstraints
- type TestDef
- type TestDefMap
- type TestDefRef
- type TestDefRefList
- type TestGroup
- type TestGroupList
- type TestGroupMap
- type TestGroupRef
- type TestGroupRefList
- type TestGuard
- type TestIterate
- type TestIterateBindings
- type TestIterateBindingsList
- type TestList
- type TestParamBinding
- type TestParamBindingMap
- type TestParamDependency
- type TestParamDependencyList
- type TestParamEnvMap
- type TestParamMap
- type TestReportPlugin
- type TestReportPluginMap
- type TestRun
- type TestRunParams
- type TestSuiteRef
Constants ¶
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" // PluginDefEmitRedactKey = "EmitJSON" PluginDefRedactKey = "Redact" // PluginDefNonzeroOnAnyErrorKey of the PluginDef map PluginDefNonzeroOnAnyErrorKey = "NonzeroOnAnyErrorKey" // PluginDefRetryKey of the PluginDef map PluginDefRetryKey = "Retry" // PluginDefIncludeDirsKey of the PluginDef map PluginDefIncludeDirsKey = "IncludeDirs" )
Variables ¶
var ThePluginRegistry = make(PluginRegistry)
ThePluginRegistry is the global, well-know registry of supported plax Plugin types
Functions ¶
This section is empty.
Types ¶
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
type Plugin ¶
type Plugin interface {
// Invoke calls the plugin
Invoke(ctx context.Context) (*junit.TestSuite, 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 ¶
GetPluginDefDir returns the Dir
func (PluginDef) GetPluginDefFilename ¶
GetPluginDefFilename returns the Filename
func (PluginDef) GetPluginDefIncludeDirsKey ¶ added in v0.5.3
GetPluginDefIncludeDirsKey returns the Includes list
func (PluginDef) GetPluginDefLabels ¶
GetPluginDefLabels returns the Labels
func (PluginDef) GetPluginDefList ¶
GetPluginDefList returns the List flag
func (PluginDef) GetPluginDefLogLevel ¶
GetPluginDefLogLevel returns the Filename
func (PluginDef) GetPluginDefName ¶
GetPluginDefName returns the Name
func (PluginDef) GetPluginDefNonzeroOnAnyErrorKey ¶
GetPluginDefNonzeroOnAnyErrorKey returns the EmitJSON flag
func (PluginDef) GetPluginDefParams ¶
GetPluginDefParams returns the Params
func (PluginDef) GetPluginDefPriority ¶
GetPluginDefPriority returns the Priority
func (PluginDef) GetPluginDefRedact ¶ added in v0.8.1
GetPluginDefRedact returns the Redact flag.
func (PluginDef) GetPluginDefRetry ¶
GetPluginDefRetry returns the Retry
func (PluginDef) GetPluginDefSeed ¶
GetPluginDefSeed returns the Seed
func (PluginDef) GetPluginDefTests ¶
GetPluginDefTests returns the list of test to run
func (PluginDef) GetPluginDefVerbose ¶
GetPluginDefVerbose returns the Filename
type PluginMaker ¶
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 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 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.
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
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.
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"`
// Redact the parameter binding flag
Redact bool `json:"redact" yaml:"redact"`
// 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 TestParamDependencyList ¶
type TestParamDependencyList []TestParamDependency
TestParamDependencyList parameter dependency list
type TestParamMap ¶
TestParamMap of parameter keys to non substituted parameter values
type TestReportPlugin ¶ added in v0.8.10
type TestReportPlugin struct {
// DependsOn the parameters in the map for configuration
DependsOn TestParamDependencyList `yaml:"dependsOn"`
// Config is the configuration (if any) for the report plugin.
Config interface{} `yaml:"config,omitempty" json:"config,omitempty"`
// contains filtered or unexported fields
}
TestReportPlugin to execute the report
func (*TestReportPlugin) Generate ¶ added in v0.8.10
func (trp *TestReportPlugin) Generate(ctx *dsl.Ctx, tpbm TestParamBindingMap, bs plaxDsl.Bindings, tr *report.TestReport) error
Generate the test report using the TestReportPlugin for the TestRun
type TestReportPluginMap ¶ added in v0.8.10
type TestReportPluginMap map[string]TestReportPlugin
TestReportPluginMap dsl for mpa of TestReportPlugins
func (TestReportPluginMap) Generate ¶ added in v0.8.10
func (trpm TestReportPluginMap) Generate(ctx *dsl.Ctx, tpbm TestParamBindingMap, bs plaxDsl.Bindings, tr *report.TestReport, emitJSON bool) error
Generate the test reports from the TestReportPluginMap for the TestRun
type TestRun ¶
type TestRun struct {
Name string `yaml:"name" json:"name"`
Version string `yaml:"version" json:"version"`
Tests TestDefMap `yaml:"tests" json:"-"`
Groups TestGroupMap `yaml:"groups" json:"-"`
Params TestParamBindingMap `yaml:"params" json:"-"`
Reports TestReportPluginMap `yaml:"reports" json:"-"`
// 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
type TestRunParams ¶
type TestRunParams struct {
Bindings plaxDsl.Bindings
Groups TestGroupList
Tests TestList
SuiteName *string
IncludeDirs IncludeDirList
Filename *string
Dir *string
ReportPluginDir *string
EmitJSON *bool
Verbose *bool
LogLevel *string
Labels *string
Priority *int
Redact *bool
}
TestRunParams used to exec a TestRun
type TestSuiteRef ¶
type TestSuiteRef struct {
// contains filtered or unexported fields
}
TestSuiteRef reference