Documentation ¶
Overview ¶
nolint
nolint
nolint
Index ¶
- Constants
- Variables
- func DefaultSetOpts(opts map[string]cty.Value, pendingOptions []PendingInput) error
- func GenerateShim(variantBin, dir string) error
- func Getenv(name string)
- func IsExpressionEmpty(ex hcl2.Expression) bool
- func MakeQuestions(pendingOptions []PendingInput) ([]*survey.Question, map[string]survey.Transformer, error)
- func Open(name string)
- func SetLogger(impl Interface)
- func SetOptsFromMap(transformers map[string]survey.Transformer, opts map[string]cty.Value, ...) error
- func Stat(name string)
- type App
- func (app *App) ExitWithError(err error)
- func (app *App) ExportBinary(srcDir, dstFile string) error
- func (app *App) ExportGo(srcDir, dstDir string) error
- func (app *App) ExportShim(srcDir, dstDir string) error
- func (app *App) Job(l *EventLogger, cmd string, args map[string]interface{}, ...) (func() (*Result, error), error)
- func (app *App) PrintDiags(err error)
- func (app *App) PrintError(err error)
- func (app *App) Run(cmd string, args map[string]interface{}, opts map[string]interface{}, ...) (*Result, error)
- func (app *App) RunTests(pat string) (*Result, error)
- func (app *App) WriteDiags(diagnostics hcl2.Diagnostics)
- type Arg
- type Assert
- type Case
- type Collect
- type Command
- type Config
- type DependsOn
- type DynamicRun
- type EnvSource
- type Event
- type EventLogger
- type Exec
- type ExecEvent
- type Forward
- type HCL2Config
- type Interface
- type JobContext
- type JobSpec
- type LazyDynamicRun
- type LazyStaticRun
- type Log
- type LogCollector
- type LogSpec
- type OptionSpec
- type Parameter
- type PendingInput
- type Result
- type RunEvent
- type SetOptsFunc
- type Source
- type SourceFile
- type SourceJob
- type StaticRun
- type Step
- type Test
- type TestDeps
- func (TestDeps) ImportPath() string
- func (TestDeps) MatchString(pat, str string) (result bool, err error)
- func (TestDeps) StartCPUProfile(w io.Writer) error
- func (TestDeps) StartTestLog(w io.Writer)
- func (TestDeps) StopCPUProfile()
- func (TestDeps) StopTestLog() error
- func (TestDeps) WriteProfileTo(name string, w io.Writer, debug int) error
- type Variable
Constants ¶
View Source
const ( NoRunMessage = "nothing to run" FormatYAML = "yaml" FormatText = "text" )
Variables ¶
View Source
var ImportPath string
ImportPath is the import path of the testing binary, set by the generated main function.
Functions ¶
func DefaultSetOpts ¶ added in v0.13.0
func DefaultSetOpts(opts map[string]cty.Value, pendingOptions []PendingInput) error
func GenerateShim ¶
func IsExpressionEmpty ¶
func IsExpressionEmpty(ex hcl2.Expression) bool
func MakeQuestions ¶ added in v0.13.0
func MakeQuestions(pendingOptions []PendingInput) ([]*survey.Question, map[string]survey.Transformer, error)
func SetLogger ¶
func SetLogger(impl Interface)
SetLogger sets the test logger implementation for the current process. It must be called only once, at process startup.
func SetOptsFromMap ¶ added in v0.13.0
Types ¶
type App ¶
type App struct { BinName string Files map[string]*hcl2.File Config *HCL2Config JobByName map[string]JobSpec Stdout, Stderr io.Writer Trace string }
func NewFromFile ¶
func (*App) ExitWithError ¶
func (*App) ExportBinary ¶
func (*App) ExportShim ¶
func (*App) Job ¶
func (app *App) Job(l *EventLogger, cmd string, args map[string]interface{}, opts map[string]interface{}, f SetOptsFunc, streamOutput bool) (func() (*Result, error), error)
func (*App) PrintDiags ¶ added in v0.21.0
func (*App) PrintError ¶
func (*App) WriteDiags ¶
func (app *App) WriteDiags(diagnostics hcl2.Diagnostics)
type Assert ¶
type Assert struct { Name string `hcl:"name,label"` Condition hcl2.Expression `hcl:"condition,attr"` }
type Case ¶
type Case struct { Name string `hcl:"name,label"` Args map[string]hcl2.Expression `hcl:",remain"` }
type Collect ¶
type Collect struct { Condition hcl2.Expression `hcl:"condition,attr"` Format hcl2.Expression `hcl:"format,attr"` }
type DependsOn ¶ added in v0.20.0
type DependsOn struct { Name string `hcl:"name,label"` Items hcl2.Expression `hcl:"items,attr"` Args hcl2.Expression `hcl:"args,attr"` }
type DynamicRun ¶ added in v0.22.0
type DynamicRun struct { Job string `hcl:"job,attr"` Args hcl2.Expression `hcl:"with,attr"` }
type EventLogger ¶
type EventLogger struct { Command string Args, Opts map[string]interface{} Stream string Stderr io.Writer Events []Event // contains filtered or unexported fields }
func NewEventLogger ¶
func NewEventLogger(cmd string, args map[string]interface{}, opts map[string]interface{}) *EventLogger
func (*EventLogger) LogRun ¶
func (l *EventLogger) LogRun(job string, args map[string]interface{}) error
func (*EventLogger) Register ¶
func (l *EventLogger) Register(logCollector LogCollector) func() error
type Exec ¶
type Exec struct { Command hcl2.Expression `hcl:"command,attr"` Args hcl2.Expression `hcl:"args,attr"` Env hcl2.Expression `hcl:"env,attr"` Dir hcl2.Expression `hcl:"dir,attr"` Interactive *bool `hcl:"interactive,attr"` }
type HCL2Config ¶
type Interface ¶
type Interface interface { Getenv(key string) Stat(file string) Open(file string) Chdir(dir string) }
Interface is the interface required of test loggers. The os package will invoke the interface's methods to indicate that it is inspecting the given environment variables or files. Multiple goroutines may call these methods simultaneously.
type JobContext ¶ added in v0.23.0
type JobContext struct {
// contains filtered or unexported fields
}
type JobSpec ¶
type JobSpec struct { //Type string `hcl:"type,label"` Name string `hcl:"name,label"` Version *string `hcl:"version,attr"` Module hcl2.Expression `hcl:"module,attr"` Description *string `hcl:"description,attr"` Parameters []Parameter `hcl:"parameter,block"` Options []OptionSpec `hcl:"option,block"` Configs []Config `hcl:"config,block"` Secrets []Config `hcl:"secret,block"` Variables []Variable `hcl:"variable,block"` Concurrency hcl2.Expression `hcl:"concurrency,attr"` SourceLocator hcl2.Expression `hcl:"__source_locator,attr"` Deps []DependsOn `hcl:"depends_on,block"` Exec *Exec `hcl:"exec,block"` Assert []Assert `hcl:"assert,block"` Fail hcl2.Expression `hcl:"fail,attr"` Import *string `hcl:"import,attr"` // Private hides the job from `variant run -h` when set to true Private *bool `hcl:"private,attr"` Log *LogSpec `hcl:"log,block"` Steps []Step `hcl:"step,block"` Body hcl2.Body `hcl:",remain"` }
type LazyDynamicRun ¶ added in v0.22.0
type LazyDynamicRun struct {
Run DynamicRun `hcl:"run,block"`
}
type LazyStaticRun ¶ added in v0.22.0
type LazyStaticRun struct {
Run StaticRun `hcl:"run,block"`
}
type LogCollector ¶
type LogSpec ¶
type LogSpec struct { File hcl2.Expression `hcl:"file,attr"` Stream hcl2.Expression `hcl:"stream,attr"` Collects []Collect `hcl:"collect,block"` Forwards []Forward `hcl:"forward,block"` }
type OptionSpec ¶
type OptionSpec struct { Name string `hcl:"name,label"` Type hcl2.Expression `hcl:"type,attr"` Default hcl2.Expression `hcl:"default,attr"` Description *string `hcl:"description,attr"` Short *string `hcl:"short,attr"` }
type Parameter ¶
type Parameter struct { Name string `hcl:"name,label"` Type hcl2.Expression `hcl:"type,attr"` Default hcl2.Expression `hcl:"default,attr"` Envs []EnvSource `hcl:"env,block"` Description *string `hcl:"description,attr"` }
type PendingInput ¶ added in v0.23.0
type SetOptsFunc ¶ added in v0.13.0
type SetOptsFunc func(opts map[string]cty.Value, pendingOptions []PendingInput) error
type SourceFile ¶
type SourceJob ¶
type SourceJob struct { Name string `hcl:"name,attr"` // This results in "no cty.Type for hcl.Expression" error //Arguments map[string]hcl2.Expression `hcl:"args,attr"` Args hcl2.Expression `hcl:"args,attr"` Format *string `hcl:"format,attr"` Key *string `hcl:"key,attr"` }
type StaticRun ¶ added in v0.22.0
type StaticRun struct { Name string `hcl:"name,label"` Args map[string]hcl2.Expression `hcl:",remain"` }
type TestDeps ¶
type TestDeps struct{}
TestDeps is an implementation of the testing.testDeps interface, suitable for passing to testing.MainStart.
func (TestDeps) ImportPath ¶
func (TestDeps) StartTestLog ¶
func (TestDeps) StopCPUProfile ¶
func (TestDeps) StopCPUProfile()
func (TestDeps) StopTestLog ¶
type Variable ¶
type Variable struct { Name string `hcl:"name,label"` Type hcl2.Expression `hcl:"type,attr"` Value hcl2.Expression `hcl:"value,attr"` }
Click to show internal directories.
Click to hide internal directories.