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 ¶
- func Capture(dir, provider string, data []byte, options Options) (string, error)
- type ConnectionReport
- type ExecutionReport
- type ExecutionStart
- type Options
- type Run
- func (r *Run) Abort() error
- func (r *Run) CloseInputWhenComplete(closeInput func() error) <-chan error
- func (r *Run) CloseSDK() error
- func (r *Run) Done() <-chan struct{}
- func (r *Run) Environment() []string
- func (r *Run) FullConsumption() <-chan struct{}
- func (r *Run) Wait(ctx context.Context) (*replay.MockAgentResult, error)
- func (r *Run) WaitError(ctx context.Context) error
- type RunOptions
- type Session
- type SessionReport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConnectionReport ¶
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 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) CloseInputWhenComplete ¶
CloseInputWhenComplete waits for full consumption and invokes closeInput without blocking the replay producer. It also exits when the run fails first.
func (*Run) CloseSDK ¶
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 ¶
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.
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 ¶
FromFixture attaches a run coordinator to an already opened fixture.
func Open ¶
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 ¶
Prepare imports authored synthetic material through the public in-process Replay library.
func (*Session) Close ¶
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 ¶
ConnectionIDs returns the sorted mock route connection inventory.
func (*Session) ExecutionIDs ¶
ExecutionIDs returns the execution IDs started by this coordinator, even if final evidence is corrupt and Report cannot be read.
func (*Session) NewRun ¶
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.