test

package
v0.14.8 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package test checks a generated registry.json against the release it describes.

registry.json is what aqua installs from, and a pull request carrying one is merged without a human reading it, so this is where the trust in the file comes from. The generator established the same things when it wrote the file; checking them again here is what makes the merge safe rather than a matter of believing the generator.

What can be checked depends on the machine. An asset in a format this machine can't open is reported and passed over rather than failed, which is why this runs on a matrix: between the runners, every format a registry holds is opened somewhere.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Environments added in v0.0.8

func Environments(w io.Writer, paths []string) error

Environments lists the environments the files describe, sorted, without repeats.

The checks run one job per environment, on a machine of that environment, and the jobs are worked out from this: a fixed list would leave an entry for an environment nobody thought of unchecked, which is the one thing a merge gate must not do.

Types

type Controller

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

Controller checks registry.json files.

func New

func New(verifier Verifier, env Environment) *Controller

New creates a Controller. An empty environment checks every entry.

func (*Controller) Run

func (c *Controller) Run(ctx context.Context, logger *slog.Logger, pkgName string, paths []string) error

Run checks every file and fails if any of them didn't hold up.

Every file is checked before returning rather than stopping at the first failure: a pull request adding several versions should say what is wrong with all of them.

type Environment added in v0.0.8

type Environment struct {
	OS   string
	Arch string
}

Environment is one os and arch, as an entry names them.

func (Environment) Empty added in v0.0.8

func (e Environment) Empty() bool

Empty says the caller named no environment, so every entry is checked.

func (Environment) String added in v0.0.8

func (e Environment) String() string

String renders the environment the way a registry writes it.

type Verifier

type Verifier interface {
	Verify(ctx context.Context, logger *slog.Logger, pkgName, version string, asset *generate.Asset) (*verify.Result, error)
}

Verifier downloads an asset and establishes what it actually holds.

Jump to

Keyboard shortcuts

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