provisiontest

package
v0.161.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 6 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 provisiontest is the CONTRACT SUITE every muster provisioner driver must pass.

🔴 THE SUITE IS THE DELIVERABLE, NOT THE DRIVERS. An interface is a promise about behaviour that its method signatures cannot express: that Create is idempotent, that a blind driver errors instead of reporting emptiness, that Destroy's nil means something. Per-driver tests written by whoever wrote each driver assert what that author believed; this suite asserts what every CALLER is entitled to assume, and it is the reason a second driver can be dropped in without auditing the call sites.

🔴 IT DOES NOT SKIP. A Harness missing any hook fails immediately rather than quietly running a subset — a suite that skips is indistinguishable in the output from one that passed, and the whole point of this package is that its verdict means something.

Add a case here rather than in a driver's own tests whenever the thing you are pinning is true of the CONTRACT. A case that only makes sense for one backend belongs in that backend's package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MinimalSpec

func MinimalSpec(name string) provision.Spec

MinimalSpec is a spec every driver must accept whatever its capabilities: a runtime and a port, and nothing that any capability gates.

⚠ IT IS DELIBERATELY THE FLOOR, NOT A REALISTIC SPEC. Cases that need a capability-gated field add it themselves, so a failure names the field that caused it instead of "the sample spec was rejected".

func RunContract

func RunContract(t *testing.T, h Harness)

RunContract runs every contract case against h.

Types

type Harness

type Harness struct {
	// Name identifies the driver in subtest names.
	Name string

	// New returns a working driver with an empty backend. Called once per
	// subtest, so cases cannot contaminate each other.
	New func(t *testing.T) provision.Provisioner

	// Blind returns a driver whose backend CANNOT BE REACHED — a dropped
	// connection, a rejecting API, a fake with no store. It is how the
	// error-never-empty rule is tested on the driver rather than asserted about
	// it.
	Blind func(t *testing.T) provision.Provisioner

	// Restricted returns the driver configured with as few capabilities as it
	// can genuinely have. It is how CheckSpec's refusals are tested against a
	// driver that really refuses, rather than against a hand-built mock that
	// agrees with the test.
	Restricted func(t *testing.T) provision.Provisioner
}

Harness is what a driver supplies to be tested.

Name, New, Blind and Restricted are REQUIRED — all four fields.

In particular Blind and Restricted are not optional conveniences: they are the only way to exercise the two rules that matter most, and a driver that cannot produce them has not thought about either failure.

Jump to

Keyboard shortcuts

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