mocktest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 17 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

Overview

Package mocktest bridges Go SDK fixture assertions to the in-process Replay library. It implements no native matching or request-correlation state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capture

func Capture(dir, provider string, data []byte, options Options) (string, error)

Capture authors a manifest-bound EXPLICITLY SYNTHETIC external input from an SDK fixture. It is not an adopted recording and contains no matching engine.

Types

type ConnectionReport

type ConnectionReport struct {
	ID     string `json:"id"`
	Status string `json:"status"`
}

type ExecutionReport

type ExecutionReport struct {
	ID          string             `json:"id"`
	Status      string             `json:"status"`
	Connections []ConnectionReport `json:"connections"`
}

type ExecutionStart

type ExecutionStart = replay.ExecutionStart

ExecutionStart is the immutable library projection used before SDK I/O.

type Options

type Options struct {
	Handshakes       string
	MaxFrames        int
	RecordingVersion string
}

type Run

type Run struct {
	Start  ExecutionStart
	Reader io.ReadCloser
	Writer io.WriteCloser
	Stderr io.ReadCloser
	// contains filtered or unexported fields
}

Run exposes the SDK-side endpoints and the Replay run handle for one connection. Reader is peer-to-SDK and Writer is SDK-to-peer.

func (*Run) Abort

func (r *Run) Abort() error

Abort cancels the run and releases both endpoint directions.

func (*Run) CloseInputWhenComplete

func (r *Run) CloseInputWhenComplete(closeInput func() error) <-chan error

CloseInputWhenComplete waits for full consumption and invokes closeInput without blocking the replay producer. It also exits when the run fails first.

func (*Run) CloseSDK

func (r *Run) CloseSDK() error

CloseSDK closes only the bridge-owned SDK endpoints. The SDK normally owns these closures; this method exists for setup failures before a client exists.

func (*Run) Done

func (r *Run) Done() <-chan struct{}

Done closes after this connection's replay, receipt and finalization end.

func (*Run) Environment

func (r *Run) Environment() []string

Environment returns the execution environment in deterministic key order.

func (*Run) FullConsumption

func (r *Run) FullConsumption() <-chan struct{}

FullConsumption reports the one-shot safe point for SDK input half-close.

func (*Run) Wait

func (r *Run) Wait(ctx context.Context) (*replay.MockAgentResult, error)

Wait returns the authoritative typed result.

func (*Run) WaitError

func (r *Run) WaitError(ctx context.Context) error

WaitError adapts Wait to codex.StreamTransport.Wait.

type RunOptions

type RunOptions struct {
	Connection  string
	ExecutionID string
	Timeout     time.Duration
	NativeArgs  []string
}

RunOptions selects one declared in-process mock connection.

type Session

type Session struct {
	Dir         string
	Workspace   string
	ProtocolCwd string
	Env         []string
	SessionID   string
	// contains filtered or unexported fields
}

Session is one prepared in-process Replay fixture. Callers start a Run for each declared connection, construct the SDK against run.Start, and remove the fixture directory after every run has reached a terminal state.

func FromFixture

func FromFixture(fixture *replay.Fixture) (*Session, error)

FromFixture attaches a run coordinator to an already opened fixture.

func Open

func Open(dir string) (*Session, error)

Open attaches to an existing fixture without consuming or deleting it. The owner may inspect typed execution evidence after this Session is closed.

func Prepare

func Prepare(dir, provider string, scenario []byte, options Options) (result *Session, err error)

Prepare imports authored synthetic material through the public in-process Replay library.

func (*Session) Close

func (s *Session) Close() error

Close removes a fixture created by Prepare after every run has terminated. Sessions from Open and FromFixture never delete the owner's fixture.

func (*Session) ConnectionIDs

func (s *Session) ConnectionIDs() []string

ConnectionIDs returns the sorted mock route connection inventory.

func (*Session) ExecutionIDs

func (s *Session) ExecutionIDs() []string

ExecutionIDs returns the execution IDs started by this coordinator, even if final evidence is corrupt and Report cannot be read.

func (*Session) NewRun

func (s *Session) NewRun(ctx context.Context, options RunOptions) (*Run, error)

NewRun starts one in-process mock connection and returns the SDK-side endpoints. Replay owns the fixture-side endpoints after Start returns.

func (*Session) Report

func (s *Session) Report() (*SessionReport, error)

Report returns an aggregate view from typed execution reports tracked by this session.

type SessionReport

type SessionReport struct {
	SchemaVersion int               `json:"schemaVersion"`
	SessionID     string            `json:"sessionId"`
	Status        string            `json:"status"`
	Executions    []ExecutionReport `json:"executions"`
}

SessionReport preserves the SDK bridge's aggregate report view without re-parsing execution files.

Jump to

Keyboard shortcuts

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