Documentation
¶
Overview ¶
Package runner defines the Runner interface and the Result it produces. Concrete runners live in subpackages (internal/runner/cmd, .../http).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
Command string
ExitCode int
Stdout []byte
Stderr []byte
Duration time.Duration
Workdir string
TimedOut bool
// TimeoutSource names the level that supplied the timeout that killed the
// command (run.timeout / runner.timeout / defaults.run.timeout /
// suite.timeout / built-in default), so the failure hint can say which
// knob to adjust (#17). Empty when TimedOut is false.
TimeoutSource string
// HTTP fields, set only by the http runner (IsHTTP reports which family is
// populated, since a zero StatusCode is indistinguishable from "no response").
IsHTTP bool
StatusCode int
Header http.Header
Body []byte
// DB fields, set only by the db runner. RowsJSON is the result rows encoded as
// a JSON array (the document the `rows` assertion target and `store from.rows`
// read); RowsAffected is set for non-row statements (INSERT/UPDATE/DDL).
IsDB bool
RowsJSON []byte
RowsAffected int64
// gRPC fields, set only by the grpc runner. GRPCStatus is the numeric status
// code; MessageJSON is the response message encoded as JSON (the document the
// `message` assertion target and `store from.message` read).
IsGRPC bool
GRPCStatus int
MessageJSON []byte
// PTY fields, set only by the pty runner. Screen is the final rendered
// terminal screen (vt10x emulation, plain text) for the `screen`
// assertion target (#27); Stdout keeps the raw transcript.
IsPTY bool
Screen []byte
// Browser fields, set only by the browser/CDP runner. CDPValue is the value
// captured by the last text/eval action (the document the `value` assertion
// target and `store from.value` read): a text capture is the raw string, an
// eval capture is JSON.
IsCDP bool
CDPValue []byte
// Changes is the workdir delta observed around a run/pty step (#70), set by
// the engine only when a `changes:` assert immediately follows the step. Nil
// means no delta was recorded (the assertion then reports that), so scenarios
// that never use `changes:` pay for no workdir scan.
Changes *fsdelta.Delta
}
Result is the externally observable outcome of a run step.
A Result describes either a process run (the cmd runner: Command, ExitCode, Stdout, Stderr) or an HTTP exchange (the http runner: IsHTTP, StatusCode, Header, Body). The engine tracks the most recent Result as the scenario's "current" observation, and assertions/stores read from whichever family of fields applies.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package browser implements the browser (CDP) runner: a `cdp` step drives a headless Chrome via the Chrome DevTools Protocol and captures a value from the page as a runner.Result.
|
Package browser implements the browser (CDP) runner: a `cdp` step drives a headless Chrome via the Chrome DevTools Protocol and captures a value from the page as a runner.Result. |
|
Package cmd implements the command Runner: it executes a real process and captures its exit code, stdout, and stderr.
|
Package cmd implements the command Runner: it executes a real process and captures its exit code, stdout, and stderr. |
|
Package db implements the database runner: it runs a SQL statement from a `query:` step through a named db runner and captures the result — rows (for a SELECT) as a JSON array, or the affected-row count (for INSERT/UPDATE/DDL) — as a runner.Result.
|
Package db implements the database runner: it runs a SQL statement from a `query:` step through a named db runner and captures the result — rows (for a SELECT) as a JSON array, or the affected-row count (for INSERT/UPDATE/DDL) — as a runner.Result. |
|
Package grpc implements the gRPC runner: a `grpc` step calls a unary method on a target server and captures the response message (as JSON) and status code as a runner.Result.
|
Package grpc implements the gRPC runner: a `grpc` step calls a unary method on a target server and captures the response message (as JSON) and status code as a runner.Result. |
|
Package http implements the HTTP runner: it issues a request described by an `http:` step and captures the response (status, headers, body) as a runner.Result.
|
Package http implements the HTTP runner: it issues a request described by an `http:` step and captures the response (status, headers, body) as a runner.Result. |
|
Package mock implements the declarative stub HTTP server behind `mock_servers:` (#24): canned routes served on an ephemeral loopback port, with every incoming request recorded for the `mock:` assertion target — so API-client CLIs (gh-style tools, cloud CLIs, webhook senders) are testable fully offline.
|
Package mock implements the declarative stub HTTP server behind `mock_servers:` (#24): canned routes served on an ephemeral loopback port, with every incoming request recorded for the `mock:` assertion target — so API-client CLIs (gh-style tools, cloud CLIs, webhook senders) are testable fully offline. |
|
Package ptyrun runs one command inside a real pseudo-terminal and drives it with a declarative expect/send session (#8).
|
Package ptyrun runs one command inside a real pseudo-terminal and drives it with a declarative expect/send session (#8). |
|
Package service runs the background processes a scenario declares under `services`: a long-lived peer (a TCP server, an API stub) started before the scenario's steps and torn down — with its whole process group — when the scenario ends.
|
Package service runs the background processes a scenario declares under `services`: a long-lived peer (a TCP server, an API stub) started before the scenario's steps and torn down — with its whole process group — when the scenario ends. |
|
Package ssh implements the SSH runner: a `run` step naming an ssh runner executes its command on a remote host over SSH, capturing stdout, stderr, and the exit code as a runner.Result.
|
Package ssh implements the SSH runner: a `run` step naming an ssh runner executes its command on a remote host over SSH, capturing stdout, stderr, and the exit code as a runner.Result. |
Click to show internal directories.
Click to hide internal directories.