Documentation
¶
Overview ¶
Package runtime contains the small shared boundary implemented by protocol modules.
Index ¶
- Constants
- func AddIssue(observation *testspec.Observation, stage string, code string)
- func ErrorCode(ctx context.Context) string
- func Exchange(step string, request Request, response Response) testspec.Exchange
- func Milliseconds(started time.Time) float64
- func NewObservation(protocol string) testspec.Observation
- func ObserveCacheWriteHeaders(response *http.Response, observation *testspec.Observation)
- func Read(response Response) ([]byte, error)
- type AssetMetadata
- type AssetResolver
- type AssetStream
- type Descriptor
- type Execution
- type Module
- type PreparedFile
- type PreparedWire
- type Request
- type Response
- type TaskProtocol
- type Transport
Constants ¶
const MaxExchanges = 1024
const MaxResponseBytes int64 = 32 << 20
Variables ¶
This section is empty.
Functions ¶
func Milliseconds ¶
func NewObservation ¶
func NewObservation(protocol string) testspec.Observation
func ObserveCacheWriteHeaders ¶
func ObserveCacheWriteHeaders(response *http.Response, observation *testspec.Observation)
ObserveCacheWriteHeaders keeps only the two public numeric usage counters. Missing headers stay missing; a later workflow step cannot inherit a value.
Types ¶
type AssetMetadata ¶
type AssetResolver ¶
type AssetResolver interface {
Open(context.Context, string) (AssetStream, error)
}
type AssetStream ¶
type AssetStream interface {
io.ReadCloser
Metadata() AssetMetadata
}
AssetStream owns one opened asset. Close must be safe concurrently with Read and unblock a blocked Read so cancellation can release every opened stream.
type Descriptor ¶
type Execution ¶
type Execution struct {
Spec testspec.Spec
Inputs testspec.ResolvedInputs
Random testspec.RandomContext
Settings testspec.RunSettings
Transport Transport
Assets AssetResolver
}
type Module ¶
type Module interface {
Descriptor() Descriptor
// ValidateProtocol checks native operation and workflow rules after Spec.Validate.
ValidateProtocol(testspec.Spec) error
Execute(context.Context, Execution) testspec.Observation
}
type PreparedFile ¶
type PreparedWire ¶
type PreparedWire struct {
SHA256 string
Bytes int64
Files []PreparedFile
}
PreparedWire describes bytes prepared by the transport, never a template or the redacted request view retained in a persisted Exchange.
func (PreparedWire) Clone ¶
func (wire PreparedWire) Clone() PreparedWire
type Request ¶
type Request struct {
Method string
Path string
Body testspec.RenderedRequest
Headers map[string]string
Assets AssetResolver
}
type Response ¶
type Response struct {
HTTP *http.Response
Started time.Time
TTFBMS float64
RequestBody json.RawMessage
PreparedWire *PreparedWire `json:"-"`
}
type TaskProtocol ¶
type TaskProtocol struct {
ID string
Label string
SubmitPath string
PollPath string
IDPointer string
StatusPointer string
UsagePointer string
ArtifactPointers map[string]string
TerminalStatuses []string
DefaultBody json.RawMessage
Headers map[string]string
}
TaskProtocol describes a supported external protocol's lifecycle. It contains no expected test outcomes; terminal failure is as observable as terminal success.
func (TaskProtocol) Descriptor ¶
func (protocol TaskProtocol) Descriptor() Descriptor
func (TaskProtocol) Execute ¶
func (protocol TaskProtocol) Execute(ctx context.Context, execution Execution) testspec.Observation
func (TaskProtocol) ValidateProtocol ¶
func (protocol TaskProtocol) ValidateProtocol(spec testspec.Spec) error