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]*hcl.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 hcl.Expression `hcl:"condition,attr"` }
type Collect ¶
type Collect struct { Condition hcl.Expression `hcl:"condition,attr"` Format hcl.Expression `hcl:"format,attr"` }
type DependsOn ¶ added in v0.20.0
type DependsOn struct { Name string `hcl:"name,label"` Items hcl.Expression `hcl:"items,attr"` Args hcl.Expression `hcl:"args,attr"` }
type DynamicRun ¶ added in v0.22.0
type DynamicRun struct { Job string `hcl:"job,attr"` Args hcl.Expression `hcl:"with,attr"` Condition hcl.Expression `hcl:"condition,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 hcl.Expression `hcl:"command,attr"` Args hcl.Expression `hcl:"args,attr"` Env hcl.Expression `hcl:"env,attr"` Dir hcl.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
}
func (JobContext) Ptr ¶ added in v0.26.0
func (c JobContext) Ptr() *JobContext
func (*JobContext) WithEvalContext ¶ added in v0.26.0
func (c *JobContext) WithEvalContext(evalCtx *hcl2.EvalContext) JobContext
func (*JobContext) WithVariable ¶ added in v0.26.0
func (c *JobContext) WithVariable(name string, v cty.Value) JobContext
type JobSpec ¶
type JobSpec struct { //Type string `hcl:"type,label"` Name string `hcl:"name,label"` Version *string `hcl:"version,attr"` Module hcl.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 hcl.Expression `hcl:"concurrency,attr"` SourceLocator hcl.Expression `hcl:"__source_locator,attr"` Deps []DependsOn `hcl:"depends_on,block"` Exec *Exec `hcl:"exec,block"` Assert []Assert `hcl:"assert,block"` Fail hcl.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 hcl.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 OptionSpec ¶
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 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 ¶
Click to show internal directories.
Click to hide internal directories.