Documentation
¶
Index ¶
- Constants
- Variables
- func BufConfig(configs ...string) grpcRunnerOption
- func BufDir(dirs ...string) grpcRunnerOption
- func BufLock(locks ...string) grpcRunnerOption
- func BufModule(modules ...string) grpcRunnerOption
- func CACert(path string) grpcRunnerOption
- func CACertFromData(b []byte) grpcRunnerOption
- func CDPFlag(flag string, tf any) cdpRunnerOption
- func CDPTimeout(timeout string) cdpRunnerOption
- func Cert(path string) grpcRunnerOption
- func CertFromData(b []byte) grpcRunnerOption
- func CreateHTTPStepMapSlice(key string, req *http.Request) (yaml.MapSlice, error)
- func DBTrace(trace bool) dbRunnerOption
- func Eval(e string, store exprtrace.EvalEnv) (any, error)
- func EvalAny(e any, store exprtrace.EvalEnv) (any, error)
- func EvalCond(cond string, store exprtrace.EvalEnv) (bool, error)
- func EvalCount(count string, store exprtrace.EvalEnv) (int, error)
- func EvalExpand(in any, store exprtrace.EvalEnv) (any, error)
- func EvalWithTrace(e string, store exprtrace.EvalEnv) (*exprtrace.EvalResult, error)
- func GRPCTrace(trace bool) grpcRunnerOption
- func HTTPCACert(path string) httpRunnerOption
- func HTTPCert(path string) httpRunnerOption
- func HTTPKey(path string) httpRunnerOption
- func HTTPSkipVerify(skip bool) httpRunnerOption
- func HTTPTimeout(timeout string) httpRunnerOption
- func HTTPTrace(trace bool) httpRunnerOption
- func Host(h string) sshRunnerOption
- func Hostname(h string) sshRunnerOption
- func IdentityFile(p string) sshRunnerOption
- func IdentityKey(k []byte) sshRunnerOption
- func ImportPaths(paths []string) grpcRunnerOption
- func KeepSession(enable bool) sshRunnerOption
- func Key(path string) grpcRunnerOption
- func KeyFromData(b []byte) grpcRunnerOption
- func Load(pathp string, opts ...Option) (*operatorN, error)
- func LoadBook(path string) (*book, error)
- func LoadEnvFile(path string) error
- func LocalForward(l string) sshRunnerOption
- func MultipartBoundary(b string) httpRunnerOption
- func New(opts ...Option) (*operator, error)
- func NewCmdOut(out io.Writer, verbose bool) *cmdOut
- func NewDebugger(out io.Writer) *debugger
- func NewLoadtResult(rc int, w, d time.Duration, c, m int, r *or.Result) (*loadtResult, error)
- func NewRunbook(desc string) *runbook
- func NotFollowRedirect(nf bool) httpRunnerOption
- func OpenAPI3(l string) httpRunnerOption
- func OpenAPI3FromData(d []byte) httpRunnerOption
- func OpenApi3(l string) httpRunnerOption
- func OpenApi3FromData(d []byte) httpRunnerOption
- func ParseRunbook(in io.Reader) (*runbook, error)
- func Port(p int) sshRunnerOption
- func Protos(protos []string) grpcRunnerOption
- func SSHConfig(p string) sshRunnerOption
- func SkipCircularReferenceCheck(skip bool) httpRunnerOption
- func SkipValidateRequest(skip bool) httpRunnerOption
- func SkipValidateResponse(skip bool) httpRunnerOption
- func TLS(useTLS bool) grpcRunnerOption
- func UseCookie(use bool) httpRunnerOption
- func User(u string) sshRunnerOption
- type AfterFuncError
- type BeforeFuncError
- type CDPAction
- type CDPActions
- type CDPArgType
- type CDPFn
- type CDPFnArg
- type CDPFnArgs
- type Capturer
- type Coverage
- type DBResponse
- type ErrUnrecoverable
- type GRPCOp
- type GRPCType
- type Loop
- type Option
- func AfterFunc(fn func(*RunResult) error) Option
- func AfterFuncIf(fn func(*RunResult) error, ifCond string) Option
- func Attach(enable bool) Option
- func BeforeFunc(fn func(*RunResult) error) Option
- func Book(path string) Option
- func Books(pathp string) ([]Option, error)
- func CDPRunner(name string, opts ...cdpRunnerOption) Option
- func Capture(c Capturer) Option
- func DBRunner(name string, client Querier) Option
- func DBRunnerWithOptions(name, dsn string, opts ...dbRunnerOption) Option
- func Debug(debug bool) Option
- func Desc(desc string) Option
- func FailFast(enable bool) Option
- func Force(enable bool) Option
- func Func(k string, v any) Option
- func GRPCBufConfig(configs ...string) Option
- func GRPCBufDir(dirs ...string) Option
- func GRPCBufLock(locks ...string) Option
- func GRPCBufModule(modules ...string) Option
- func GRPCImportPaths(paths []string) Option
- func GRPCNoTLS(noTLS bool) Option
- func GRPCProtos(protos []string) Option
- func GrpcRunner(name string, cc *grpc.ClientConn) Option
- func GrpcRunnerWithOptions(name, target string, opts ...grpcRunnerOption) Option
- func HTTPOpenApi3s(locations []string) Option
- func HTTPRunner(name, endpoint string, client *http.Client, opts ...httpRunnerOption) Option
- func HTTPRunnerWithHandler(name string, h http.Handler, opts ...httpRunnerOption) Option
- func HostRules(rules ...string) Option
- func Interval(d time.Duration) Option
- func LoadOnly() Option
- func Overlay(path string) Option
- func Profile(enable bool) Option
- func RunConcurrent(enable bool, max int) Option
- func RunID(ids ...string) Option
- func RunLabel(labels ...string) Option
- func RunMatch(m string) Option
- func RunRandom(n int) Option
- func RunSample(n int) Option
- func RunShard(n, i int) Option
- func RunShuffle(enable bool, seed int64) Option
- func Runner(name, dsn string, opts ...httpRunnerOption) Option
- func SSHRunner(name string, client *ssh.Client) Option
- func SSHRunnerWithOptions(name string, opts ...sshRunnerOption) Option
- func Scopes(scopes ...string) Option
- func Secret(secrets ...string) Option
- func SkipIncluded(enable bool) Option
- func SkipTest(enable bool) Option
- func Stderr(w io.Writer) Option
- func Stdout(w io.Writer) Option
- func T(t *testing.T) Option
- func Trace(enable bool) Option
- func Underlay(path string) Option
- func Var(k any, v any) Option
- func WaitTimeout(d time.Duration) Option
- type Querier
- type RunResult
- type RunnerType
- type SpecCoverage
- type StepResult
- type Trail
- type TrailType
- type Trails
- type TxQuerier
- type UnsupportedError
Constants ¶
const ( AllowReadParent = scope.AllowReadParent AllowReadRemote = scope.AllowReadRemote AllowRunExec = scope.AllowRunExec //nostyle:repetition )
const ( MediaTypeApplicationJSON = "application/json" MediaTypeTextPlain = "text/plain" MediaTypeApplicationFormUrlencoded = "application/x-www-form-urlencoded" MediaTypeMultipartFormData = "multipart/form-data" )
const DefaultTraceHeaderName = "X-Runn-Trace"
Variables ¶
var ( AsTestHelper = T Runbook = Book RunPart = RunShard //nostyle:repetition )
var CDPFnMap = map[string]CDPFn{ "navigate": { Desc: "Navigate the current frame to `url` page.", Fn: chromedp.Navigate, Args: CDPFnArgs{ {CDPArgTypeArg, "url", "https://pkg.go.dev/time"}, }, }, "tabTo": { Desc: "Change current frame to the tab with the specified `url`.", Fn: func() chromedp.Action { return nil }, Args: CDPFnArgs{ {CDPArgTypeArg, "url", "https://pkg.go.dev/time"}, }, }, "click": { Desc: "Send a mouse click event to the first element node matching the selector (`sel`).", Fn: chromedp.Click, Args: CDPFnArgs{ {CDPArgTypeArg, "sel", "nav > div > a"}, }, }, "doubleClick": { Desc: "Send a mouse double click event to the first element node matching the selector (`sel`).", Fn: chromedp.DoubleClick, Args: CDPFnArgs{ {CDPArgTypeArg, "sel", "nav > div > li"}, }, }, "sendKeys": { Desc: "Send keys (`value`) to the first element node matching the selector (`sel`).", Fn: chromedp.SendKeys, Args: CDPFnArgs{ {CDPArgTypeArg, "sel", "input[name=username]"}, {CDPArgTypeArg, "value", "k1lowxb@gmail.com"}, }, }, "submit": { Desc: "Submit the parent form of the first element node matching the selector (`sel`).", Fn: chromedp.Submit, Args: CDPFnArgs{ {CDPArgTypeArg, "sel", "form.login"}, }, }, "scroll": { Desc: "Scroll the window to the first element node matching the selector (`sel`).", Fn: chromedp.ScrollIntoView, Args: CDPFnArgs{ {CDPArgTypeArg, "sel", "body > footer"}, }, Aliases: []string{"scrollIntoView"}, }, "wait": { Desc: "Wait for the specified `time`.", Fn: func(d string) chromedp.Action { return &waitAction{d: d} }, Args: CDPFnArgs{ {CDPArgTypeArg, "time", "10sec"}, }, Aliases: []string{"sleep"}, }, "waitReady": { Desc: "Wait until the element matching the selector (`sel`) is ready.", Fn: chromedp.WaitReady, Args: CDPFnArgs{ {CDPArgTypeArg, "sel", "body > footer"}, }, }, "waitVisible": { Desc: "Wait until the element matching the selector (`sel`) is visible.", Fn: chromedp.WaitVisible, Args: CDPFnArgs{ {CDPArgTypeArg, "sel", "body > footer"}, }, }, "setUserAgent": { Desc: "Set the default User-Agent", Fn: func(ua string) []chromedp.Action { headers := map[string]any{"User-Agent": ua} return []chromedp.Action{ network.Enable(), network.SetExtraHTTPHeaders(network.Headers(headers)), } }, Args: CDPFnArgs{ {CDPArgTypeArg, "userAgent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"}, }, Aliases: []string{"setUA", "ua", "userAgent"}, }, "text": { Desc: "Get the visible text of the first element node matching the selector (`sel`).", Fn: chromedp.Text, Args: CDPFnArgs{ {CDPArgTypeArg, "sel", "h1"}, {CDPArgTypeRes, "text", "Install the latest version of Go"}, }, Aliases: []string{"getText"}, }, "textContent": { Desc: "Get the text content of the first element node matching the selector (`sel`).", Fn: chromedp.TextContent, Args: CDPFnArgs{ {CDPArgTypeArg, "sel", "h1"}, {CDPArgTypeRes, "text", "Install the latest version of Go"}, }, Aliases: []string{"getTextContent"}, }, "innerHTML": { Desc: "Get the inner html of the first element node matching the selector (`sel`).", Fn: chromedp.InnerHTML, Args: CDPFnArgs{ {CDPArgTypeArg, "sel", "h1"}, {CDPArgTypeRes, "html", "Install the latest version of Go"}, }, Aliases: []string{"getInnerHTML"}, }, "outerHTML": { Desc: "Get the outer html of the first element node matching the selector (`sel`).", Fn: chromedp.OuterHTML, Args: CDPFnArgs{ {CDPArgTypeArg, "sel", "h1"}, {CDPArgTypeRes, "html", "<h1>Install the latest version of Go</h1>"}, }, Aliases: []string{"getOuterHTML"}, }, "fullHTML": { Desc: "Get the full html of page.", Fn: func(html *string) chromedp.Action { expr := "new XMLSerializer().serializeToString(document);" return chromedp.Evaluate(expr, html) }, Args: CDPFnArgs{ {CDPArgTypeRes, "html", "<!DOCTYPE html><html><body><h1>hello</h1></body></html>"}, }, Aliases: []string{"getFullHTML", "getHTML", "html"}, }, "value": { Desc: "Get the Javascript value field of the first element node matching the selector (`sel`).", Fn: chromedp.Value, Args: CDPFnArgs{ {CDPArgTypeArg, "sel", "input[name=address]"}, {CDPArgTypeRes, "value", "Fukuoka"}, }, Aliases: []string{"getValue"}, }, "setUploadFile": { Desc: "Set upload file (`path`) to the first element node matching the selector (`sel`).", Fn: func(sel, path string) chromedp.Action { abs, err := filepath.Abs(path) if err != nil { return &errAction{err: err} } if _, err := os.Stat(abs); err != nil { return &errAction{err: err} } return chromedp.SetUploadFiles(sel, []string{abs}) }, Args: CDPFnArgs{ {CDPArgTypeArg, "sel", "input[name=avator]"}, {CDPArgTypeArg, "path", "/path/to/image.png"}, }, Aliases: []string{"setUpload"}, }, "title": { Desc: "Get the document `title`.", Fn: chromedp.Title, Args: CDPFnArgs{ {CDPArgTypeRes, "title", "GitHub"}, }, Aliases: []string{"getTitle"}, }, "location": { Desc: "Get the document location.", Fn: chromedp.Location, Args: CDPFnArgs{ {CDPArgTypeRes, "url", "https://github.com"}, }, Aliases: []string{"getLocation"}, }, "attributes": { Desc: "Get the element attributes for the first element node matching the selector (`sel`).", Fn: chromedp.Attributes, Args: CDPFnArgs{ {CDPArgTypeArg, "sel", "h1"}, {CDPArgTypeRes, "attrs", `{"class": "sr-only"}`}, }, Aliases: []string{"getAttributes", "attrs", "getAttrs"}, }, "screenshot": { Desc: "Take a full screenshot of the entire browser viewport.", Fn: func(b *[]byte) chromedp.Action { return chromedp.FullScreenshot(b, 100) }, Args: CDPFnArgs{ {CDPArgTypeRes, "png", "[]byte"}, }, Aliases: []string{"getScreenshot"}, }, "evaluate": { Desc: "Evaluate the Javascript expression (`expr`).", Fn: func(expr string) chromedp.Action { return chromedp.Evaluate(expr, nil) }, Args: CDPFnArgs{ {CDPArgTypeArg, "expr", `document.querySelector("h1").textContent = "hello"`}, }, Aliases: []string{"eval"}, }, "localStorage": { Desc: "Get localStorage items.", Fn: func(origin string, items *map[string]string) chromedp.Action { return chromedp.ActionFunc(func(ctx context.Context) error { frameTree, err := page.GetFrameTree().Do(ctx) if err != nil { return err } strageKey := domstorage.SerializedStorageKey(frameTree.Frame.SecurityOrigin + "/") storageID := &domstorage.StorageID{ StorageKey: strageKey, IsLocalStorage: true, } resp, err := domstorage.GetDOMStorageItems(storageID).Do(ctx) if err != nil { return err } m := make(map[string]string) for _, v := range resp { if len(v) != 2 { continue } m[v[0]] = v[1] } *items = m return nil }) }, Args: CDPFnArgs{ {CDPArgTypeArg, "origin", "https://github.com"}, {CDPArgTypeRes, "items", `{"key": "value"}`}, }, Aliases: []string{"getLocalStorage"}, }, "sessionStorage": { Desc: "Get sessionStorage items.", Fn: func(origin string, items *map[string]string) chromedp.Action { return chromedp.ActionFunc(func(ctx context.Context) error { frameTree, err := page.GetFrameTree().Do(ctx) if err != nil { return err } strageKey := domstorage.SerializedStorageKey(frameTree.Frame.SecurityOrigin + "/") storageID := &domstorage.StorageID{ StorageKey: strageKey, IsLocalStorage: false, } resp, err := domstorage.GetDOMStorageItems(storageID).Do(ctx) if err != nil { return err } m := make(map[string]string) for _, v := range resp { if len(v) != 2 { continue } m[v[0]] = v[1] } *items = m return nil }) }, Args: CDPFnArgs{ {CDPArgTypeArg, "origin", "https://github.com"}, {CDPArgTypeRes, "items", `{"key": "value"}`}, }, Aliases: []string{"getSessionStorage"}, }, }
var ErrFailFast = errors.New("fail fast")
var ErrNilBook = errors.New("runbook is nil")
Functions ¶
func CACertFromData ¶ added in v0.26.0
func CACertFromData(b []byte) grpcRunnerOption
func CDPTimeout ¶ added in v0.138.0
func CDPTimeout(timeout string) cdpRunnerOption
CDPTimeout sets the timeout for each CDP step. The timeout should be a valid duration string (e.g., "30s", "2m", "1m30s"). Default timeout is 60 seconds if not specified.
func CertFromData ¶ added in v0.26.0
func CertFromData(b []byte) grpcRunnerOption
func CreateHTTPStepMapSlice ¶ added in v0.40.0
CreateHTTPStepMapSlice creates yaml.MapSlice from *http.Request.
func Eval ¶ added in v0.50.0
Eval evaluates an expression using the provided environment store and returns the result.
func EvalAny ¶ added in v0.80.0
EvalAny evaluate any type. but, EvalAny do not evaluate map key. EvalAny evaluates any type of value, recursively evaluating expressions in strings. Note that map keys are not evaluated.
func EvalCond ¶ added in v0.50.0
EvalCond evaluates a condition expression and returns a boolean result.
func EvalCount ¶ added in v0.50.0
EvalCount evaluates an expression that should result in an integer value. This is typically used for loop counts or other numeric expressions.
func EvalExpand ¶ added in v0.50.0
EvalExpand evaluates `in` and expand `{{ }}` in `in` using `store`. EvalExpand evaluates an input value and expands any expressions in {{ }} using the provided store. This is used for template-like string interpolation within configuration values.
func EvalWithTrace ¶ added in v0.108.0
EvalWithTrace evaluates an expression with tracing and returns the evaluation result with trace information. This is useful for debugging expressions and understanding how they are evaluated.
func HTTPCACert ¶ added in v0.57.2
func HTTPCACert(path string) httpRunnerOption
func HTTPSkipVerify ¶ added in v0.74.1
func HTTPSkipVerify(skip bool) httpRunnerOption
func HTTPTimeout ¶ added in v0.76.0
func HTTPTimeout(timeout string) httpRunnerOption
func IdentityFile ¶ added in v0.52.0
func IdentityFile(p string) sshRunnerOption
func IdentityKey ¶ added in v0.59.3
func IdentityKey(k []byte) sshRunnerOption
func ImportPaths ¶ added in v0.75.0
func ImportPaths(paths []string) grpcRunnerOption
ImportPaths set import paths.
func KeepSession ¶ added in v0.52.0
func KeepSession(enable bool) sshRunnerOption
func KeyFromData ¶ added in v0.26.0
func KeyFromData(b []byte) grpcRunnerOption
func Load ¶ added in v0.2.0
Load loads multiple runbooks from the specified path pattern and returns an operatorN that can execute all of them. It applies environment options and any additional options provided. The path pattern can include glob patterns to match multiple files.
func LoadBook ¶
LoadBook loads a runbook from the specified file path. It parses the YAML file and returns a book structure containing the runbook configuration.
func LoadEnvFile ¶ added in v0.111.0
LoadEnvFile loads the environment variables from the given file immediately.
func LocalForward ¶ added in v0.59.0
func LocalForward(l string) sshRunnerOption
func MultipartBoundary ¶ added in v0.49.0
func MultipartBoundary(b string) httpRunnerOption
func NewDebugger ¶ added in v0.33.0
func NewLoadtResult ¶ added in v0.57.0
NewLoadtResult creates a new load test result with the provided parameters. It calculates various metrics such as error rate, requests per second, and percentiles.
func NewRunbook ¶ added in v0.40.0
func NewRunbook(desc string) *runbook
NewRunbook creates a new runbook with the specified description. If no description is provided, a default one is used.
func NotFollowRedirect ¶ added in v0.38.0
func NotFollowRedirect(nf bool) httpRunnerOption
func OpenAPI3 ¶ added in v0.100.0
func OpenAPI3(l string) httpRunnerOption
OpenAPI3 sets OpenAPI Document using file path.
func OpenAPI3FromData ¶ added in v0.100.0
func OpenAPI3FromData(d []byte) httpRunnerOption
OpenAPI3FromData sets OpenAPI Document from data.
func OpenApi3 ¶ added in v0.13.0
func OpenApi3(l string) httpRunnerOption
OpenApi3 sets OpenAPI Document using file path. Deprecated: Use OpenAPI3 instead.
func OpenApi3FromData ¶ added in v0.13.0
func OpenApi3FromData(d []byte) httpRunnerOption
OpenApi3FromData sets OpenAPI Document from data. Deprecated: Use OpenAPI3FromData instead.
func ParseRunbook ¶ added in v0.49.0
ParseRunbook parses a runbook from the provided reader. It reads the YAML content and converts it into a runbook structure.
func SkipCircularReferenceCheck ¶ added in v0.118.0
func SkipCircularReferenceCheck(skip bool) httpRunnerOption
SkipCircularReferenceCheck sets whether to skip circular reference check in OpenAPI Document.
func SkipValidateRequest ¶ added in v0.13.0
func SkipValidateRequest(skip bool) httpRunnerOption
SkipValidateRequest sets whether to skip validation of HTTP request with OpenAPI Document.
func SkipValidateResponse ¶ added in v0.13.0
func SkipValidateResponse(skip bool) httpRunnerOption
SkipValidateResponse sets whether to skip validation of HTTP response with OpenAPI Document.
Types ¶
type AfterFuncError ¶ added in v0.48.0
type AfterFuncError struct {
// contains filtered or unexported fields
}
func (*AfterFuncError) Error ¶ added in v0.48.0
func (e *AfterFuncError) Error() string
func (*AfterFuncError) Unwrap ¶ added in v0.48.0
func (e *AfterFuncError) Unwrap() error
type BeforeFuncError ¶ added in v0.48.0
type BeforeFuncError struct {
// contains filtered or unexported fields
}
func (*BeforeFuncError) Error ¶ added in v0.48.0
func (e *BeforeFuncError) Error() string
func (*BeforeFuncError) Unwrap ¶ added in v0.48.0
func (e *BeforeFuncError) Unwrap() error
type CDPActions ¶ added in v0.47.0
type CDPActions []CDPAction
type CDPArgType ¶ added in v0.47.0
type CDPArgType string
const ( CDPArgTypeArg CDPArgType = "arg" CDPArgTypeRes CDPArgType = "res" )
type CDPFnArg ¶ added in v0.47.0
type CDPFnArg struct {
Typ CDPArgType
Key string
Example string
}
type Capturer ¶ added in v0.33.0
type Capturer interface {
CaptureStart(trs Trails, bookPath, desc string)
CaptureResult(trs Trails, result *RunResult)
CaptureEnd(trs Trails, bookPath, desc string)
CaptureResultByStep(trs Trails, result *RunResult)
CaptureHTTPRequest(name string, req *http.Request)
CaptureHTTPResponse(name string, res *http.Response)
CaptureGRPCStart(name string, typ GRPCType, service, method string)
CaptureGRPCRequestHeaders(h map[string][]string)
CaptureGRPCRequestMessage(m map[string]any)
CaptureGRPCResponseStatus(*status.Status)
CaptureGRPCResponseHeaders(h map[string][]string)
CaptureGRPCResponseMessage(m map[string]any)
CaptureGRPCResponseTrailers(t map[string][]string)
CaptureGRPCClientClose()
CaptureGRPCEnd(name string, typ GRPCType, service, method string)
CaptureCDPStart(name string)
CaptureCDPAction(a CDPAction)
CaptureCDPResponse(a CDPAction, res map[string]any)
CaptureCDPEnd(name string)
CaptureSSHCommand(command string)
CaptureSSHStdout(stdout string)
CaptureSSHStderr(stderr string)
CaptureDBStatement(name string, stmt string)
CaptureDBResponse(name string, res *DBResponse)
CaptureExecCommand(command, shell string, background bool)
CaptureExecStdin(stdin string)
CaptureExecStdout(stdout string)
CaptureExecStderr(stderr string)
SetCurrentTrails(trs Trails)
Errs() error
}
type Coverage ¶ added in v0.84.1
type Coverage struct {
Specs []*SpecCoverage `json:"specs"`
}
Coverage is a coverage of runbooks.
type DBResponse ¶ added in v0.33.0
type ErrUnrecoverable ¶ added in v0.140.0
type ErrUnrecoverable struct {
// contains filtered or unexported fields
}
func (*ErrUnrecoverable) Error ¶ added in v0.140.0
func (e *ErrUnrecoverable) Error() string
func (*ErrUnrecoverable) Unwrap ¶ added in v0.140.0
func (e *ErrUnrecoverable) Unwrap() error
type Loop ¶ added in v0.29.0
type Loop struct {
Count string `yaml:"count,omitempty"`
Interval string `yaml:"interval,omitempty"`
MinInterval string `yaml:"minInterval,omitempty"`
MaxInterval string `yaml:"maxInterval,omitempty"`
Jitter *float64 `yaml:"jitter,omitempty"`
Multiplier *float64 `yaml:"multiplier,omitempty"`
Until string `yaml:"until"`
// contains filtered or unexported fields
}
type Option ¶
type Option func(*book) error
func AfterFunc ¶ added in v0.20.0
AfterFunc - Register the function to be run after the runbook is run.
func AfterFuncIf ¶ added in v0.50.0
AfterFuncIf - Register the function to be run after the runbook is run if condition is true.
func BeforeFunc ¶ added in v0.20.0
BeforeFunc - Register the function to be run before the runbook is run.
func DBRunnerWithOptions ¶ added in v0.88.0
DBRunnerWithOptions - Set DB runner to runbook using options.
func GRPCBufConfig ¶ added in v0.105.1
GRPCBufConfig - Set the path to the buf.yaml file for gRPC runners.
func GRPCBufDir ¶ added in v0.106.0
GRPCBufDir - Set the buf directory for gRPC runners.
func GRPCBufLock ¶ added in v0.105.1
GRPCBufLock - Set the path to the buf.lock file for gRPC runners.
func GRPCBufModule ¶ added in v0.105.1
GRPCBufModule - Set the buf modules for gRPC runners.
func GRPCImportPaths ¶ added in v0.75.0
GRPCImportPaths - Set the path to the directory where proto sources can be imported for gRPC runners.
func GRPCProtos ¶ added in v0.75.0
GRPCProtos - Set the name of proto source for gRPC runners.
func GrpcRunner ¶ added in v0.24.0
func GrpcRunner(name string, cc *grpc.ClientConn) Option
GrpcRunner - Set gRPC runner to runbook.
func GrpcRunnerWithOptions ¶ added in v0.66.0
GrpcRunnerWithOptions - Set gRPC runner to runbook using options.
func HTTPOpenApi3s ¶ added in v0.86.0
HTTPOpenApi3s - Set the path of OpenAPI Document for HTTP runners.
func HTTPRunner ¶
HTTPRunner - Set HTTP runner to runbook.
func HTTPRunnerWithHandler ¶ added in v0.6.0
HTTPRunnerWithHandler - Set HTTP runner to runbook with http.Handler.
func RunConcurrent ¶ added in v0.64.0
RunConcurrent - Run runbooks concurrently.
func RunID ¶ added in v0.78.0
RunID - Run the matching runbooks in order if there is only one runbook with a forward matching ID.
func RunRandom ¶ added in v0.46.0
RunRandom - Run the specified number of runbooks at random. Sometimes the same runbook is run multiple times.
func RunShard ¶ added in v0.23.0
RunShard - Distribute runbooks into a specified number of shards and run the specified shard of them.
func RunShuffle ¶ added in v0.39.0
RunShuffle - Randomize the order of running runbooks.
func SSHRunnerWithOptions ¶ added in v0.52.0
SSHRunnerWithOptions - Set SSH runner to runbook using options.
func SkipIncluded ¶ added in v0.19.0
SkipIncluded - Skip running the included step by itself.
func WaitTimeout ¶ added in v0.99.0
WaitTimeout - Set the timeout for waiting for sub-processes to complete after the Run or RunN context is canceled.
type RunResult ¶ added in v0.48.0
type RunResult struct {
ID string // Runbook ID
Desc string // Description of runbook
Labels []string // Labels of runbook
Path string // Path of runbook
Skipped bool // Whether runbook run was skipped or not
Err error // Error during runbook run.
StepResults []*StepResult // Step results of runbook run
Elapsed time.Duration // Elapsed time of runbook run
// contains filtered or unexported fields
}
RunResult is the result of a runbook run.
func (*RunResult) OutFailure ¶ added in v0.81.1
type RunnerType ¶ added in v0.45.0
type RunnerType string
const ( RunnerTypeHTTP RunnerType = "http" RunnerTypeDB RunnerType = "db" RunnerTypeGRPC RunnerType = "grpc" RunnerTypeCDP RunnerType = "cdp" RunnerTypeSSH RunnerType = "ssh" RunnerTypeExec RunnerType = "exec" RunnerTypeTest RunnerType = "test" RunnerTypeDump RunnerType = "dump" RunnerTypeInclude RunnerType = "include" RunnerTypeBind RunnerType = "bind" )
type SpecCoverage ¶ added in v0.84.1
SpecCoverage is a coverage of spec (e.g. OpenAPI Document, servive of protocol buffers).
type StepResult ¶ added in v0.68.0
type StepResult struct {
ID string // Runbook ID
Index int // Index of step
Key string // Key of step
Desc string // Description of step
Skipped bool // Whether step run was skipped or not
Err error // Error during step run.
IncludedRunResults []*RunResult // Run results of runbook loaded by include runner
Elapsed time.Duration // Elapsed time of step run
}
StepResult is the result of a step run.
type Trail ¶ added in v0.78.0
type Trail struct {
Type TrailType `json:"type"`
Desc string `json:"desc,omitempty"`
RunbookID string `json:"id,omitempty"`
RunbookPath string `json:"path,omitempty"`
StepIndex *int `json:"step_index,omitempty"`
StepKey string `json:"step_key,omitempty"`
StepRunnerType RunnerType `json:"step_runner_type,omitempty"`
StepRunnerKey string `json:"step_runner_key,omitempty"`
FuncIndex *int `json:"func_index,omitempty"`
LoopIndex *int `json:"loop_index,omitempty"`
}
Trail - The trail of elements in the runbook at runtime. Trail does not use slices to copy values.
type UnsupportedError ¶ added in v0.17.1
type UnsupportedError struct {
Cause error
}
func (*UnsupportedError) Error ¶ added in v0.17.1
func (e *UnsupportedError) Error() string
func (*UnsupportedError) Unwrap ¶ added in v0.17.1
func (e *UnsupportedError) Unwrap() error
Source Files
¶
- alias.go
- bind.go
- book.go
- capturer.go
- cdp.go
- cdpfn.go
- cmdout.go
- color.go
- coverage.go
- db.go
- dbg.go
- debugger.go
- defer.go
- desc.go
- dump.go
- env.go
- errors.go
- exec.go
- force.go
- grpc.go
- hosts.go
- http.go
- http_validator.go
- id.go
- if.go
- include.go
- loadt.go
- loop.go
- operator.go
- option.go
- parse.go
- result.go
- runbook.go
- runner_option.go
- runner_runner.go
- ssh.go
- step.go
- test.go
- trace.go
- trail.go
- vars.go
- yaml.go