scripts

package
v1.18.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultScriptTimeout = 30 * time.Second

Variables

This section is empty.

Functions

This section is empty.

Types

type Response added in v0.5.0

type Response struct {
	Kind            ResponseKind
	Status          string
	Code            int
	URL             string
	Time            time.Duration
	Header          http.Header
	Body            []byte
	Wire            []byte
	WireContentType string
	// ContentType carries the best-known type for the Body payload (may be empty).
	ContentType string
}

func (*Response) Clone added in v0.5.0

func (r *Response) Clone() *Response

type ResponseKind added in v0.5.0

type ResponseKind string
const (
	ResponseKindHTTP ResponseKind = "http"
	ResponseKindGRPC ResponseKind = "grpc"
)

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(fs filelookup.FileSystem) *Runner

func (*Runner) RunPreRequest

func (r *Runner) RunPreRequest(
	scripts []restfile.ScriptBlock,
	input prerequest.Input,
) (prerequest.Output, error)

func (*Runner) RunTests

func (r *Runner) RunTests(
	ctx context.Context,
	scripts []restfile.ScriptBlock,
	input TestInput,
) ([]scriptapi.TestResult, vars.Globals, error)

type StreamInfo added in v0.5.0

type StreamInfo struct {
	Kind    string
	Summary map[string]any
	Events  []map[string]any
	// Err reports a stream that did not finish cleanly. Scripts still see the
	// events that arrived.
	Err error
}

StreamInfo carries streaming session data for script consumption.

func (*StreamInfo) Clone added in v0.5.0

func (info *StreamInfo) Clone() *StreamInfo

type TestInput

type TestInput struct {
	Response  *Response
	Variables map[string]string
	Globals   vars.Globals
	BaseDir   string
	Stream    *StreamInfo
	Trace     *TraceInput
	Secrets   *vars.Secrets
}

type TraceBudget added in v0.6.0

type TraceBudget struct {
	Total     time.Duration
	Tolerance time.Duration
	Phases    map[string]time.Duration
}

TraceBudget represents optional latency budgets configured for a request.

type TraceInput added in v0.6.0

type TraceInput struct {
	Timeline *nettrace.Timeline
	Budgets  TraceBudget
}

TraceInput carries timeline and budget information into the scripting runtime.

func NewTraceInput added in v0.6.0

func NewTraceInput(tl *nettrace.Timeline, spec *restfile.TraceSpec) *TraceInput

NewTraceInput converts a timeline/spec pair into a scripting input, cloning data to keep it immutable.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL