fixtures

package
v1.0.0-alpha.13 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package fixtures reads the declared coordinate of this repo's published test-fixture modules, so tests pin the version the tree carries instead of a literal that has to be edited on every bump.

IDENTICAL COPY in cli/tests/fixtures/fixtures.go and opm-operator/test/fixtures/fixtures.go. The workspace root `task fixtures:lint` fails when the two drift; edit both.

A fixture lives at <this dir>/modules/<name>/ and its identity package (identity/identity.cue) is the single source of ModulePath and Version. The identity package is import-free by design, so loading it needs no registry and no CUE_REGISTRY mapping. hack/fixtures.sh reads the same two fields with `cue eval ./identity`; this is the Go spelling of that read.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dir

func Dir() (string, error)

Dir returns the absolute path of the fixture modules directory. FIXTURES_DIR overrides the location next to this file (for trimmed builds or an out-of-tree checkout).

Types

type Coordinate

type Coordinate struct {
	// ModulePath is the major-suffixed CUE module path, e.g.
	// testing.opmodel.dev/modules/operator/hello@v0.
	ModulePath string
	// Version is the bare SemVer, e.g. 0.0.6.
	Version string
}

Coordinate is a fixture's declared module path and bare SemVer version.

func Load

func Load(name string) (Coordinate, error)

Load reads the coordinate of the fixture module <Dir()>/<name>.

func Must

func Must(t Failer, name string) Coordinate

Must is Load for tests: a fixture that cannot be read fails the test.

func (Coordinate) Tag

func (c Coordinate) Tag() string

Tag is the registry tag for the version: "v" + Version.

type Failer

type Failer interface {
	Helper()
	Fatal(args ...any)
}

Failer is the slice of *testing.T (and Ginkgo's GinkgoT()) that Must needs.

Jump to

Keyboard shortcuts

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