Documentation
¶
Index ¶
- Constants
- func Run(cmd Command) error
- type AmbiguousNodeIDError
- type AndFilter
- type ChartsFCT
- type ChartsTCPInfo
- type ChartsTimeSeries
- type Command
- type Config
- type DuplicateTestIDError
- type EmitLog
- type EmitTCPInfo
- type FileExistsError
- type FlowSeries
- type NoDataFileError
- type OrFilter
- type Parallel
- type RegexFilter
- type Report
- type ReportCommand
- type RunCommand
- type SaveFiles
- type Serial
- type Test
- type TestFilter
- type TestID
- type TestRun
- type VetCommand
Constants ¶
const Version = "0.3.0"
Version represents the Antler version.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AmbiguousNodeIDError ¶
AmbiguousNodeIDError is returned when multiple Nodes use the same ID but with different field values.
func (*AmbiguousNodeIDError) Error ¶
func (a *AmbiguousNodeIDError) Error() string
type AndFilter ¶
type AndFilter []TestFilter
AndFilter accepts a Test if each of its TestFilters accepts it.
type ChartsFCT ¶
type ChartsFCT struct {
// To lists the names of files to execute the template to. A file of "-"
// emits to stdout.
To []string
// Series matches Flows to series.
Series []FlowSeries
// Options is an arbitrary structure of Charts options, with defaults
// defined in config.cue.
// https://developers.google.com/chart/interactive/docs/gallery/scatterchart#configuration-options
Options map[string]interface{}
}
ChartsFCT is a reporter that makes time series plots using Google Charts.
type ChartsTCPInfo ¶
type ChartsTCPInfo struct {
// FlowLabel sets custom labels for Flows.
FlowLabel map[node.Flow]string
// To lists the names of files to execute the template to. A file of "-"
// emits to stdout.
To []string
// Options is an arbitrary structure of Charts options, with defaults
// defined in config.cue.
// https://developers.google.com/chart/interactive/docs/gallery/linechart#configuration-options
Options map[string]interface{}
}
ChartsTCPInfo is a reporter that makes TCPInfo plots using Google Charts.
type ChartsTimeSeries ¶
type ChartsTimeSeries struct {
// FlowLabel sets custom labels for Flows.
FlowLabel map[node.Flow]string
// To lists the names of files to execute the template to. A file of "-"
// emits to stdout.
To []string
// Options is an arbitrary structure of Charts options, with defaults
// defined in config.cue.
// https://developers.google.com/chart/interactive/docs/gallery/linechart#configuration-options
Options map[string]interface{}
}
ChartsTimeSeries is a reporter that makes time series plots using Google Charts.
type Command ¶
type Command interface {
// contains filtered or unexported methods
}
A Command is an Antler command.
type Config ¶
type Config struct {
// Run is the top-level TestRun instance.
Run TestRun
}
Config is the Antler configuration, loaded from CUE.
type DuplicateTestIDError ¶
type DuplicateTestIDError struct {
ID []TestID
}
DuplicateTestIDError is returned when multiple Tests have the same ID.
func (*DuplicateTestIDError) Error ¶
func (d *DuplicateTestIDError) Error() string
type EmitLog ¶
type EmitLog struct {
// To lists the destinations to send output to. "-" sends output to stdout,
// and everything else sends output to the named file. If To is empty,
// output is emitted to stdout.
To []string
}
EmitLog is a reporter that emits LogEntry's to files and/or stdout.
type EmitTCPInfo ¶
type EmitTCPInfo struct {
// To lists the destinations to send output to. "-" sends output to stdout,
// and everything else sends output to the named file. If To is empty,
// output is emitted to stdout.
To []string
}
EmitTCPInfo is a reporter that emits TCPInfo to files and/or stdout.
type FileExistsError ¶
type FileExistsError struct {
Path string
}
FileExistsError is returned by Writer when the named file already exists, and overwrite is false. The Path field is the path to the file.
func (*FileExistsError) Error ¶
func (f *FileExistsError) Error() string
type FlowSeries ¶
FlowSeries groups flows into series by matching the Flow ID with a Regex.
func (*FlowSeries) Compile ¶
func (s *FlowSeries) Compile() (err error)
Compile compiles Pattern to a Regexp.
type NoDataFileError ¶
type NoDataFileError struct {
Test *Test
}
NoDataFileError is returned by DataWriter ot DataReader when the Test's DataFile field is empty, so no data may be read or written. The Test field is the corresponding Test.
func (*NoDataFileError) Error ¶
func (n *NoDataFileError) Error() string
type OrFilter ¶
type OrFilter []TestFilter
OrFilter accepts a Test if any of its TestFilters accepts it.
type RegexFilter ¶
RegexFilter is a TestFilter that matches Tests by their ID using regular expressions. If any of a Test ID's key/value pairs match the non-nil expressions in Key and Value, the Test is accepted. If both Key and Value are nil (i.e. a zero value RegexFilter), all Tests are accepted.
func NewRegexFilterArg ¶
func NewRegexFilterArg(arg string) (flt *RegexFilter, err error)
NewRegexFilterArg returns a new RegexFilter from a string argument. The argument may be either a single pattern matching the value of any ID field, or a string in the form key=value, where key and value are separate patterns that must match both a Test ID key and value for it to be accepted.
func (*RegexFilter) Accept ¶
func (f *RegexFilter) Accept(test *Test) bool
Accept implements antler.TestFilter
type Report ¶
type Report struct {
// contains filtered or unexported fields
}
Report represents the report configuration.
type ReportCommand ¶
type ReportCommand struct {
// Filter selects which tests to run.
Filter TestFilter
// SkippedFiltered is called when a test was skipped because it was rejected
// by the Filter.
SkippedFiltered func(test *Test)
// SkippedNoDataFile is called when a report was skipped because the Test's
// DataFile field is empty.
SkippedNoDataFile func(test *Test)
// SkippedNotFound is called when a report was skipped because the data file
// needed to run it doesn't exist.
SkippedNotFound func(test *Test, path string)
}
ReportCommand runs reports.
type RunCommand ¶
type RunCommand struct {
// Control is used to send node control signals.
Control node.Control
// Force re-runs the test and overwrites any existing data.
Force bool
// Filter selects which tests to run.
Filter TestFilter
// SkippedFiltered is called when a test was skipped because it was rejected
// by the Filter.
SkippedFiltered func(test *Test)
// SkippedDataFileExists is called when a test was skipped because there's
// already an output data file for it and RunCommand.Force is false.
SkippedDataFileExists func(test *Test, path string)
}
RunCommand runs tests and reports.
type Test ¶
type Test struct {
// ID uniquely identifies the Test in the test package.
ID TestID
// OutputPrefix is the base path for output files. It may use Go template
// syntax, and is further documented in config.cue.
OutputPrefix string
// DataFile is the name of the gob output file containing the raw result
// data. If empty, raw result data is not saved for the Test.
DataFile string
// Run is the top-level Run instance.
node.Run
// Report lists Reports to be run on this Test.
Report reports
}
Test is an Antler test.
func (*Test) DataReader ¶
func (t *Test) DataReader() (rc io.ReadCloser, err error)
DataReader returns a ReadCloser for reading result data.
If DataFile is empty, NoDataFileError is returned.
If the data file does not exist, errors.Is(err, fs.ErrNotExist) returns true.
func (*Test) DataWriter ¶
func (t *Test) DataWriter(overwrite bool) (wc io.WriteCloser, err error)
DataWriter returns a WriteCloser for writing result data.
The overwrite parameter indicates whether to overwrite existing data (if true), or not (if false), in which case FileExistsError is returned if the file referred to by DataFile already exists.
If DataFile is empty, NoDataFileError is returned.
func (*Test) OutputPath ¶
OutputPath returns the path to an output file, by appending the given name to the base output path generated by OutputPrefix. If name is empty, the base OutputPrefix is returned.
func (*Test) Writer ¶
Writer returns a WriteCloser for writing result data.
The overwrite parameter indicates whether to overwrite an existing file (if true), or not (if false), in which case FileExistsError is returned if the file referred to by name already exists.
Any directories in name are automatically created.
type TestFilter ¶
A TestFilter accepts or rejects Tests.
type TestID ¶
TestID represents a compound Test identifier. Keys and values must match the regex defined in config.cue.
type TestRun ¶
type TestRun struct {
// Test is the Test to run (non-nil on leaf TestRun's).
Test *Test
// Report lists Reports to be run on this TestRun and any below it in the
// TestRun tree.
Report reports
// Serial lists TestRun's to be executed sequentially.
Serial Serial
// Parallel lists TestRun's to be executed concurrently.
Parallel Parallel
}
TestRun contains the information needed to orchestrate the execution of Tests and Reports. A TestRun may have a Test, or nested TestRun's listed in the Serial or Parallel fields, which are executed sequentially or concurrently, respectively. TestRun's may thus be arranged in a hierarchy to coordinate the serial and parallel execution of Tests.
