Documentation ¶
Index ¶
- func Run(ctx context.Context, cmd Command) error
- type AmbiguousNodeIDError
- type Analyze
- type AndFilter
- type BoolFilter
- type ChartsFCT
- type ChartsTimeSeries
- type Codec
- type Codecs
- type Command
- type Config
- type DataFileUnsetError
- type DuplicateResultPrefixError
- type DuplicateTestIDError
- type EmitLog
- type EmitSysInfo
- type Encode
- type FileRef
- type FlowSeries
- type LinkError
- type LogEntry
- type OrFilter
- type Parallel
- type RegexFilter
- type Report
- type ReportCommand
- type ReportInfo
- type ResultInfo
- type ResultReader
- type ResultWriter
- type Results
- type RunCommand
- type RunInfo
- type SaveFiles
- type Serial
- type Server
- type ServerCommand
- type Test
- func (t *Test) DataHasError(rw resultRW) (hasError bool, err error)
- func (t *Test) DataReader(rw resultRW) (rc io.ReadCloser, err error)
- func (t *Test) DataWriter(rw resultRW) (wc io.WriteCloser, err error)
- func (t *Test) LinkPriorData(rw resultRW) (err error)
- func (t *Test) RW(work resultRW) resultRW
- type TestFilter
- type TestID
- type TestRun
- type VetCommand
Constants ¶
This section is empty.
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
Error implements error
type Analyze ¶ added in v0.4.0
type Analyze struct {
// contains filtered or unexported fields
}
Analyze is a reporter that processes stream and packet data for reports. This must be in the Report pipeline *before* reporters that require it.
type AndFilter ¶
type AndFilter []TestFilter
AndFilter accepts a Test if each of its TestFilters accepts it. AndFilter panics if it has no TestFilters.
type BoolFilter ¶ added in v0.4.0
type BoolFilter bool
BoolFilter is a TestFilter that accepts (if true) or rejects all Tests.
func (BoolFilter) Accept ¶ added in v0.4.0
func (b BoolFilter) Accept(test *Test) bool
Accept implements TestFilter.
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]any }
ChartsFCT is a reporter that makes time series 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]any }
ChartsTimeSeries is a reporter that makes time series plots using Google Charts.
type Codec ¶ added in v0.4.0
type Codec struct { ID string Extension []string Encode string EncodeArg []string EncodePriority int Decode string DecodeArg []string DecodePriority int }
Codec configures a file encoder/decoder.
type Command ¶
type Command interface {
// contains filtered or unexported methods
}
A Command is an Antler command.
type DataFileUnsetError ¶ added in v0.4.0
type DataFileUnsetError struct {
Test *Test
}
DataFileUnsetError is returned by DataWriter or 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 (DataFileUnsetError) Error ¶ added in v0.4.0
func (n DataFileUnsetError) Error() string
Error implements error
type DuplicateResultPrefixError ¶ added in v0.4.0
type DuplicateResultPrefixError struct {
ResultPrefix []string
}
DuplicateResultPrefixError is returned when multiple Tests have the same ResultPrefix.
func (DuplicateResultPrefixError) Error ¶ added in v0.4.0
func (d DuplicateResultPrefixError) Error() string
Error implements error
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
Error implements error
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 // Sort, if true, indicates to gather the logs, sort them by time, and emit // them after "in" is closed. Sort bool }
EmitLog is a reporter that emits LogEntry's to files and/or stdout.
type EmitSysInfo ¶ added in v0.4.0
type EmitSysInfo 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. If two contains the verb %s, it is replaced // by the Node ID. To []string }
EmitSysInfo is a reporter that emits SysInfoData's to files and/or stdout.
type Encode ¶ added in v0.4.0
type Encode struct { File []string // list of glob patterns of files to encode Extension string // extension for newly encoded files (e.g. ".gz") ReEncode bool // if true, allow re-encoding of file Destructive bool // if true, delete originals upon success }
Encode is a reporter that encodes files referenced by FileRefs.
type FileRef ¶ added in v0.4.0
type FileRef struct {
Name string
}
FileRef is sent as a data item by SaveFiles to record the presence of a file with the specified Name, even after its FileData items may have been consumed.
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 LinkError ¶ added in v0.4.0
type LinkError struct {
Name string
}
LinkError is returned by resultRW.Link when the named file could not be found in any prior result.
type LogEntry ¶ added in v0.4.0
A LogEntry returns a node.LogEntry that should be logged. The method name GetLogEntry is non-idiomatic so that node.LogEntry may be embedded in implementations.
type OrFilter ¶
type OrFilter []TestFilter
OrFilter accepts a Test if any of its TestFilters accepts it. OrFilter panics if it has no TestFilters.
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 TestFilter
type ReportCommand ¶
type ReportCommand struct { // DataFileUnset is called when a report was skipped because the Test's // DataFile field is empty. DataFileUnset func(test *Test) // NotFound is called when a report was skipped because the data file needed // to run it doesn't exist. NotFound func(test *Test, name string) // Reporting is called when a report starts running. Reporting func(test *Test) // Done is called when the ReportCommand is done. Done func(ReportInfo) }
ReportCommand runs the After reports using the data files as the source.
type ReportInfo ¶ added in v0.4.0
ReportInfo contains stats and info for a report run.
type ResultInfo ¶ added in v0.4.0
type ResultInfo struct { Name string // base name of result directory Path string // path to result directory }
ResultInfo contains information on one result.
type ResultReader ¶ added in v0.4.0
type ResultReader struct { // Name is the name of the result file as requested. This is not the name of // a file on the filesystem. Name string // Path is the path to the result file actually read, which may be either an // encoded or unencoded version of the file. Path string // Codec is the Codec used to decode the file. The zero value of Codec means // the file is read directly. Codec Codec // ReadCloser reads the result file, decoding it transparently if needed. io.ReadCloser }
ResultReader reads a result file.
type ResultWriter ¶ added in v0.4.0
type ResultWriter struct { // Name is the name of the result file as requested. This does not // correspond to the name of a file on the filesystem. Name string // Path is the path to the result file actually written, including WorkDir // and the result prefix. Path string // Codec is the Codec used to encode the file (based on Name's extension). // The zero value of Codec means the file is written directly. Codec Codec // WriteCloser writes the result file, encoding it transparently if needed. io.WriteCloser // contains filtered or unexported fields }
ResultWriter writes a result file.
type Results ¶ added in v0.4.0
type Results struct { RootDir string WorkDir string ResultDirUTC bool ResultDirFormat string LatestSymlink string Codec Codecs }
Results configures the behavior for reading and writing result files, which include all output files and reports.
Callers must use the open method to obtain a resultRW to read and write results in WorkDir. See the doc on resultRW for more info.
type RunCommand ¶
type RunCommand struct { // Filter selects which Tests to run. If Filter is nil, Tests which were not // run before or had errors are run. Filter TestFilter // Skipped is called when a Test was skipped because it wasn't accepted by // the Filter. Skipped func(*Test) // ReRunning is called when a Test is being re-run because the prior result // contains errors. ReRunning func(*Test) // Linked is called when Test data was linked from a prior run. Linked func(*Test) // Running is called when a Test starts running. Running func(*Test) // Done is called when the RunCommand is done. Done func(RunInfo) }
RunCommand runs tests and reports.
type RunInfo ¶ added in v0.4.0
type RunInfo struct { sync.Mutex Start time.Time Elapsed time.Duration Ran int Linked int ResultDir string }
RunInfo contains stats and info for a test run.
type SaveFiles ¶
type SaveFiles struct {
Consume bool
}
SaveFiles is a reporter that saves FileData. If Consume is true, FileData items are not forwarded to the out channel.
type ServerCommand ¶ added in v0.4.0
type ServerCommand struct { }
ServerCommand runs the builtin web server.
type Test ¶
type Test struct { // ID uniquely identifies the Test in the test package. ID TestID // ResultPrefix is the path prefix for result files. It may use Go template // syntax, and is further documented in config.cue. ResultPrefix string // DataFile is the name of the gob 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 // During contains Reports to be run while the Test is run. During Report // Report contains Reports to be run after the Test is run. Report Report // ResultPrefixX contains the output of the executed ResultPrefix template. ResultPrefixX string }
Test is an Antler test.
func (*Test) DataHasError ¶ added in v0.4.0
DataHasError returns true if the DataFile exists and has errors. See DataReader for the errors that may be returned.
func (*Test) DataReader ¶
func (t *Test) DataReader(rw resultRW) (rc io.ReadCloser, err error)
DataReader returns a ReadCloser for reading result data.
If DataFile is empty, DataFileUnsetError is returned.
If the data file does not exist, errors.Is(err, fs.ErrNotExist) returns true.
func (*Test) DataWriter ¶
func (t *Test) DataWriter(rw resultRW) (wc io.WriteCloser, err error)
DataWriter returns a WriteCloser for writing result data to the work directory.
If DataFile is empty, DataFileUnsetError is returned.
func (*Test) LinkPriorData ¶ added in v0.4.0
LinkPriorData creates hard links to the most recent result data for this Test. DataFile is linked, along with any FileRefs it contains.
If DataFile is empty, DataFileUnsetError is returned.
If no prior result data for this Test could be found, LinkError is returned.
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 // Serial lists TestRun's to be executed sequentially. Serial Serial // Parallel lists TestRun's to be executed concurrently. Parallel Parallel // Report contains Reports to be run on this TestRun, and any below it in // the TestRun tree. Report Report }
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.