recordingtest

package
v1.261126.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MPL-2.0 Imports: 12 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 recordingtest provides shared test helpers for exercising internal/recording's AttachRecorderHooks/ProtocolRecorder wiring through the production *protocolserver.ProtocolHandler entry points.

This is a plain (non-_test.go) package rather than an external recording_test file because its helpers must be importable both from internal/recording's own tests and from internal/server's e2e tests — Go test files, even in an external _test package, are never importable from another package. It lives under internal/protocolserver (not internal/recording) because it imports protocolserver: placed next to the package it drives, recording's production tree stays free of any protocolserver import. It adds no import cycle because protocolserver's production code never imports recordingtest.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CtxWithTimeout

func CtxWithTimeout(t *testing.T) context.Context

Types

type MemExporter

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

MemExporter captures Records emitted by the BatchProcessor for inspection. The mutex is mandatory: BatchProcessor exports on its own goroutine.

func NewRecordingTestHandler

func NewRecordingTestHandler(t *testing.T, scenario typ.RuleScenario, mode obs.RecordMode) (*protocolserver.ProtocolHandler, *obs.Sink, *MemExporter)

NewRecordingTestHandler builds a *protocolserver.ProtocolHandler whose GetOrCreateScenarioSink callback always returns the same in-memory-backed sink for scenario, mirroring what root's *Server does via its scenarioRecordSinks map.

func (*MemExporter) Export

func (m *MemExporter) Export(_ context.Context, rs []*obs.Record) error

func (*MemExporter) Shutdown

func (m *MemExporter) Shutdown(context.Context) error

func (*MemExporter) Snapshot

func (m *MemExporter) Snapshot() []*obs.Record

type StreamableRecorder

type StreamableRecorder struct {
	*httptest.ResponseRecorder
	// contains filtered or unexported fields
}

StreamableRecorder adds CloseNotifier to httptest.ResponseRecorder so gin.Context.Stream (which ProcessStream calls) doesn't panic.

func NewRecordingTestContext

func NewRecordingTestContext(t *testing.T, body []byte) (*gin.Context, *StreamableRecorder)

NewRecordingTestContext builds a gin.Context wired to a StreamableRecorder, with a POST /v1/messages request carrying body as its JSON payload.

func NewStreamableRecorder

func NewStreamableRecorder() *StreamableRecorder

func (*StreamableRecorder) CloseNotify

func (s *StreamableRecorder) CloseNotify() <-chan bool

Jump to

Keyboard shortcuts

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