wiretest

package
v1.235.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 15 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 wiretest is test support for the entry points that run artifact operations: the CLI, workflow and custom-command steps, script step calls, and kind: step hooks.

A Fixture builds a real service over a real local directory repository in a temporary directory, pins the clock and the operation IDs, and installs the service through the artifact step's service seam. Every entry point then reaches the same wiring, and a test can compare what each one asked for and received against a baseline run of the shared implementation.

Index

Constants

View Source
const (
	// OperationID is the operation ID every fixture service and artifact step generates.
	OperationID = "op-fixed"

	// Alias is the repository alias of the fixture's local directory repository.
	Alias = "dir"

	// Name and Version are the artifact the fixture source publishes.
	Name    = "team/app"
	Version = "1.0.0"
)

Pinned values every fixture uses, so independent runs produce byte-identical records.

Variables

View Source
var PreparedAt = time.Date(2026, 10, 31, 12, 0, 0, 0, time.UTC)

PreparedAt is the pinned UTC preparation time.

Functions

func Config

func Config(root string) *schema.AtmosConfiguration

Config returns a configuration with one local directory repository rooted at root.

Types

type Fixture

type Fixture struct {
	// Root is the repository root of the entry point under test.
	Root string

	// Source is a directory with the content to publish.
	Source string

	// Config is the Atmos configuration that declares the repository.
	Config *schema.AtmosConfiguration

	// Recorder records the publications that pass through the service seam.
	Recorder *artifacttest.Recorder
	// contains filtered or unexported fields
}

Fixture is a pinned artifact environment.

func New

func New(t *testing.T) *Fixture

New creates the fixture and installs its service for artifact steps. The seams are restored when the test ends.

func (*Fixture) Baseline

func (f *Fixture) Baseline(t *testing.T) *invoke.Result

Baseline runs the fixture publication through the shared implementation, which is what the CLI runs, in a sibling repository. The result is normalized with Fixture.Normalize as if it came from the fixture's own repository.

func (*Fixture) Normalize

Normalize rewrites the repository root of the fixture to a placeholder, so results from repositories rooted in different directories compare equal.

func (*Fixture) Params

func (f *Fixture) Params() *invoke.Params

Params returns the parameters of the fixture publication. Every entry point is configured to publish exactly this.

func (*Fixture) StepFields

func (f *Fixture) StepFields() map[string]any

StepFields returns the artifact step fields of the fixture publication, as authored in YAML.

Jump to

Keyboard shortcuts

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