Documentation
¶
Overview ¶
Package fakebin turns the test binary into fake executables such as terragrunt or mise. A sidecar spec next to each link says what the fake prints and how it exits, and every call is recorded.
Index ¶
Constants ¶
const ExitInterrupted = 130
ExitInterrupted is the exit code of a blocking fake that was interrupted.
Variables ¶
This section is empty.
Functions ¶
func Install ¶
Install links the test binary into a new temp directory as name and returns the link's path.
Types ¶
type Call ¶
type Call struct {
Args []string `json:"args"`
Dir string `json:"dir"`
Env map[string]string `json:"env,omitempty"`
}
Call is one recorded invocation.
type File ¶
File copies Src, a file or a directory relative to the fake's directory, to the path that follows Flag in the call's args, as in "--report-file <path>" or "--report-file=<path>".
type Rule ¶
type Rule struct {
Args []string `json:"args,omitempty"`
Dir string `json:"dir,omitempty"` // suffix of the working directory, slash-separated; empty matches any
Stdout string `json:"stdout,omitempty"`
StdoutFile string `json:"stdout_file,omitempty"` // appended after Stdout; relative to the fake's directory
Stderr string `json:"stderr,omitempty"`
ExitCode int `json:"exit_code,omitempty"`
Block bool `json:"block,omitempty"` // wait for SIGINT/SIGTERM, then exit 130
IgnoreInterrupt bool `json:"ignore_interrupt,omitempty"` // with Block: only a kill ends the process
Files []File `json:"files,omitempty"` // written before the rule answers
}
Rule is one canned response.