conformance

package
v1.234.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Overview

Package conformance runs explicit local plugin fixtures and authored Atmos test steps.

Index

Constants

View Source
const (
	// FormatText prints human-readable progress and a summary on the UI channel.
	FormatText = "text"
	// FormatJSON prints the machine-readable report on the data channel.
	FormatJSON = "json"
)

Variables

This section is empty.

Functions

func Describe

func Describe(name string) string

Describe returns the human-readable label for a stable result name.

func Present

func Present(report *Report, err error, format string) error

Present reports a finished run. Failures that the report already shows are marked reported, so the root error handler exits non-zero without printing the same failure a second time. Other errors, such as a policy denial or a --run filter that selected nothing, are returned unchanged and keep their explanation and hints.

func Show

func Show(result Result)

Show prints one completed check. A failing check is followed by its recorded evidence, so the reader sees expected versus actual values without rerunning the suite in another format.

Types

type CommandFixture

type CommandFixture struct {
	Name      string   `yaml:"name"`
	Arguments []string `yaml:"arguments,omitempty"`
	Stdout    string   `yaml:"stdout"`
	Stderr    string   `yaml:"stderr"`
	ExitCode  int      `yaml:"exit_code"`
}

CommandFixture asserts both output channels and the process status.

type Config

type Config struct {
	Version     int                   `yaml:"version"`
	OIDC        *OIDCFixture          `yaml:"oidc,omitempty"`
	Commands    []CommandFixture      `yaml:"commands,omitempty"`
	Steps       []schema.WorkflowStep `yaml:"steps,omitempty"`
	Integration []schema.WorkflowStep `yaml:"integration,omitempty"`
}

Config declares mock protocol fixtures separately from opt-in live tests.

type GoSourceRunner

type GoSourceRunner struct{ Runner process.Runner }

GoSourceRunner builds and tests a standalone Go module through the shared process runner. Runner is optional and defaults to the normal subprocess implementation.

func (GoSourceRunner) Run

func (source GoSourceRunner) Run(ctx context.Context, request *SourceRequest) error

Run performs explicitly requested source tasks. Coverage includes the Go module's unit tests, independently of plugin.tests.yaml authored protocol/integration steps.

type OIDCFixture

type OIDCFixture struct {
	Provider string `yaml:"provider"`
	Identity string `yaml:"identity"`
	Session  string `yaml:"session"`
}

OIDCFixture selects the scaffold's versioned private-session conformance contract.

type Options

type Options struct {
	Run         string
	Integration bool
	// Build compiles the selected native target before conformance.
	Build bool
	// Platform asserts a declared target executable on this host.
	Platform string
	// CoverProfile collects Go module unit coverage at a package-relative path.
	CoverProfile string
	// SourceRunner overrides source build/coverage operations for another authoring runtime.
	SourceRunner SourceRunner
	// Project is the project directory that policy input.path is relative to. Empty means the
	// current directory.
	Project        string
	Stdout, Stderr io.Writer
	// Registry supplies extension contracts and their local conformance hooks.
	// A nil registry uses the contracts registered by Atmos bootstrap.
	Registry *extension.Registry
	// OnResult receives each completed check for live human-readable progress.
	// Result names remain stable for machine reports and --run selectors.
	OnResult func(Result)
}

Options controls fixture selection and the shared assertion output streams.

type Report

type Report struct {
	Mode    string   `json:"mode"`
	Results []Result `json:"results"`
	// contains filtered or unexported fields
}

Report keeps mock conformance separate from explicitly requested live tests.

func Run

func Run(ctx context.Context, directory string, options Options) (*Report, error)

Run validates the package, optionally builds and collects unit coverage, then launches the selected native executable and runs authored conformance fixtures.

type Result

type Result struct {
	Name   string `json:"name"`
	Passed bool   `json:"passed"`
	Detail string `json:"detail,omitempty"`
}

Result reports case names and outcomes. A failed fixture also carries Detail, the expected and observed values that differ, truncated and passed through secret masking. Raw plugin transport errors may contain credentials and never appear here unmasked.

type SourceRequest

type SourceRequest struct {
	Directory    string
	Platform     string
	Build        bool
	CoverProfile string
	Streams      process.Streams
}

SourceRequest describes optional source preparation before native conformance.

type SourceRunner

type SourceRunner interface {
	Run(context.Context, *SourceRequest) error
}

SourceRunner separates authoring-runtime operations from protocol conformance. Go is the default; alternate runtimes can supply their own implementation.

Jump to

Keyboard shortcuts

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