testutil

package
v0.10.15 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const RecordProviderCassettesEnv = "FIZEAU_RECORD_PROVIDER_CASSETTES"

Variables

This section is empty.

Functions

func CassettePath

func CassettePath(dir, name string) string

CassettePath joins a base directory and cassette name using the file layout go-vcr expects.

func ModeForEnvironment

func ModeForEnvironment() recorder.Mode

ModeForEnvironment selects the cassette mode for provider tests.

Replay-only is the default so tests stay offline unless an explicit record run is requested.

func NewRecorder

func NewRecorder(cassettePath string) (*recorder.Recorder, error)

NewRecorder creates a recorder rooted at cassettePath.

The recorder defaults to replay-only mode, uses a stable matcher that ignores host/port churn and common auth/header noise, and redacts secret headers before saving.

func RedactSensitiveHeaders

func RedactSensitiveHeaders(i *cassette.Interaction) error

RedactSensitiveHeaders removes auth/API key headers before a cassette is written to disk.

func StableMatcher

func StableMatcher() recorder.MatcherFunc

StableMatcher compares requests by method, normalized URL, headers, and body.

The URL normalization intentionally ignores scheme/host/port so the same cassette can be replayed against different local servers while still distinguishing /v1/models, /metrics, /slots, and /v1/chat/completions.

func UseDefaultTransport

func UseDefaultTransport(t testing.TB, rec *recorder.Recorder)

UseDefaultTransport installs the recorder as the process-wide default transport for the duration of the test.

Types

This section is empty.

Jump to

Keyboard shortcuts

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