providerfixture

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package providerfixture owns governed provider-response fixtures for tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdateRequested

func UpdateRequested() bool

UpdateRequested reports whether the caller explicitly selected fixture refresh with the test binary's -update flag.

Types

type Fixture

type Fixture struct {
	Provider     string
	PayloadPath  string
	MetadataPath string
}

Fixture identifies one provider capture and its adjacent metadata.

func Discover

func Discover(root string) ([]Fixture, error)

Discover returns every complete provider fixture below root in provider-ID order.

func Find

func Find(root, provider string) (Fixture, error)

Find resolves one explicit provider fixture below root.

func (Fixture) Capture

func (f Fixture) Capture(payload []byte, capturedAt time.Time) error

Capture replaces the payload and metadata after an explicit live refresh. It preserves the fixture's reviewed maximum-age policy.

func (Fixture) Decode

func (f Fixture) Decode(destination any) error

Decode unmarshals the fixture payload into destination.

func (Fixture) Read

func (f Fixture) Read() ([]byte, error)

Read returns caller-owned fixture payload bytes.

func (Fixture) Verify

func (f Fixture) Verify(now time.Time) error

Verify validates fixture identity, bytes, source revision, and freshness.

type FixtureMetadata

type FixtureMetadata struct {
	Version        uint64                       `json:"version"`
	Provider       string                       `json:"provider"`
	FetchedAt      time.Time                    `json:"fetched_at"`
	SourceRevision evidence.ObservationRevision `json:"source_revision"`
	Payload        FixturePayload               `json:"payload"`
	MaxAge         string                       `json:"max_age"`
}

FixtureMetadata binds a provider fixture to its source revision and freshness policy.

type FixturePayload

type FixturePayload struct {
	Path     string `json:"path"`
	Checksum string `json:"checksum"`
}

FixturePayload identifies the exact fixture bytes governed by metadata.

Jump to

Keyboard shortcuts

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