conformance

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT 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 conformance is the backend conformance suite: what every dispatch adapter must show at object level, checked through the SPI alone (spec 0003 D11).

Index

Constants

This section is empty.

Variables

View Source
var DefaultTimings = Timings{Wait: time.Minute, Quiet: defaultQuiet, Poll: defaultPoll}

DefaultTimings are the waits a harness that sets none gets, sized for the memory adapter.

Functions

func Backend

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

Backend runs the whole suite against the harness's adapter. Each optional interface's checks run only when the type assertion succeeds, and are skipped with a reason otherwise.

func Core

func Core(t *testing.T, h CoreHarness)

Core runs every check of spec 0001's rules through the real Operator and a supervise.Supervisor, observing through Observer.Get. Each check runs in a testing/synctest bubble, so deadlines and windows pass on a fake clock.

Types

type CessationAnswer

type CessationAnswer int

CessationAnswer is what Faults.Cessation makes the site command do.

const (
	CessationCeased CessationAnswer = iota
	CessationNotCeased
	CessationFail
	CessationHang
	CessationNone
)

The answers.

type CoreCluster

type CoreCluster struct {
	Cluster dispatch.Cluster
	// Backend is the adapter Cluster composes; the supervisor drives it, and checks without a
	// store create objects through it.
	Backend dispatch.Backend
	// Store is the record store Cluster was composed with; nil without one.
	Store records.Records
	Env   CoreEnv
}

CoreCluster is one opened cluster and what the checks drive it through.

type CoreEnv

type CoreEnv struct {
	// Run starts an execution of an object that is past its gate and runnable.
	Run func(t *testing.T, ref model.ObjectRef)
	// End ends the running execution with cause, as the scheduler reports it.
	End func(t *testing.T, ref model.ObjectRef, cause model.Cause)
	// Preempt and LoseNode act on the running execution as the scheduler would.
	Preempt, LoseNode func(t *testing.T, ref model.ObjectRef)
	// Purge removes an ended object from Find now; HistoryUnreadable makes history unreadable or
	// readable again; CancelNextStart has someone else cancel and purge the next object created,
	// after its Start replies and before any Find shows it.
	Purge             func(t *testing.T, ref model.ObjectRef)
	HistoryUnreadable func(t *testing.T, on bool)
	CancelNextStart   func(t *testing.T)
}

CoreEnv makes the scheduler act on an object, failing t when it cannot. Each may be nil; a check needing a nil one is skipped with a reason.

type CoreHarness

type CoreHarness struct {
	// Open returns a fresh cluster set up as s asks, with its own ground truth and store. It
	// returns false when the adapter cannot be set up that way, and the check is skipped with a
	// reason, never passed. It is called inside a testing/synctest bubble.
	Open func(t *testing.T, s CoreSetup) (*CoreCluster, bool)
}

CoreHarness opens the clusters conformance.Core drives: the core composed over one adapter, with or without a record store (spec 0001 D14).

type CoreSetup

type CoreSetup struct {
	Store    bool
	ReadOnly bool
	// NoRequeuer opens the adapter without its Requeuer, where it has one.
	NoRequeuer bool
	// History opens the adapter keeping history, so a purged object's end stays readable through
	// Inspect (spec 0003 D13, amended 2026-10-27).
	History bool
	// Capabilities, Perform and Native override what the adapter answers from Capabilities,
	// Rules (by the rule's action) and NativePolicyCompiler.Native.
	Capabilities map[model.Capability]model.Tristate
	Perform      map[model.Action]model.Tristate
	Native       map[model.Action]model.Tristate
}

CoreSetup is what one check needs of the cluster.

func (CoreSetup) String

func (s CoreSetup) String() string

type Faults

type Faults struct {
	// Preempt, LoseNode and RequeueExternally act on ref's running execution. DelaySubmitReply
	// is given a zero ref and delays the reply of the next Start.
	Preempt, LoseNode, RequeueExternally, DelaySubmitReply func(t *testing.T, ref model.ObjectRef)
	// LateCall holds the next hold-family or requeue call on ref in flight until its deadline +
	// bound has passed, then lets it reach the scheduler.
	LateCall func(t *testing.T, ref model.ObjectRef)
	// CrashBetweenSteps ends the next Requeue on ref after its first step, Requeue=1, as a
	// crash of the caller would: neither the requeue nor the restore runs (spec 0003 D10).
	CrashBetweenSteps func(t *testing.T, ref model.ObjectRef)
	// Cessation makes the site's cessation command answer a from now on, under the test t; with
	// CessationNone no source is configured (spec 0003 D11, D12).
	Cessation func(t *testing.T, a CessationAnswer)
	// Purge removes ref's ended object from Find now, as the scheduler's purge would.
	// HistoryUnreadable makes the adapter's history unreadable, as an accounting outage does, or
	// readable again (spec 0003 D11, amended 2026-10-27).
	Purge             func(t *testing.T, ref model.ObjectRef)
	HistoryUnreadable func(t *testing.T, on bool)
	// Beat publishes b as the launcher's beat for ref's running execution, where the adapter reads
	// it; MalformedBeat publishes one appcause.DecodeBeat refuses (spec 0003 D11, amended
	// 2026-11-02).
	Beat          func(t *testing.T, ref model.ObjectRef, b appcause.Beat)
	MalformedBeat func(t *testing.T, ref model.ObjectRef)
	// CauseDocument puts doc where the adapter reads ref's current execution's cause document.
	CauseDocument func(t *testing.T, ref model.ObjectRef, doc []byte)
	// End ends ref's running execution as the scheduler would report k. It takes only
	// CauseNonZeroExit or CauseOutOfMemory, and fails the test on any other kind.
	End func(t *testing.T, ref model.ObjectRef, k model.CauseKind)
}

Faults are the fault injections of spec 0003 D11.

type Harness

type Harness struct {
	// Open returns a Backend over the cluster the test t uses. Calls with the same t see the
	// same objects, read-only or not.
	Open func(t *testing.T, readOnly bool) dispatch.Backend
	// Faults each may be nil; an uninjectable fault is skipped with a reason, never passed.
	Faults Faults
	// Ranks returns the DISPATCH_* environment every rank of ref's current execution sees. It
	// is not in spec 0003 D11's Harness: without it the identity check cannot see a rank and
	// is skipped. Nil when the harness cannot read a rank's environment.
	Ranks func(t *testing.T, ref model.ObjectRef) []map[string]string
	// Spec returns the job every check submits. A real cluster's must run long enough for
	// Running and the ranks to be observed. Nil submits Command ["true"] on two nodes, which
	// only an adapter that runs nothing can hold in Running.
	Spec func(t *testing.T) model.JobSpec
	// Timings bounds the waits; a zero field takes DefaultTimings' value.
	Timings Timings
}

Harness opens the adapter under test and injects the faults it can.

type Timings

type Timings struct {
	// Wait is how long a check waits for the scheduler to show a state.
	Wait time.Duration
	// Quiet is how long a check watches for something that must not happen.
	Quiet time.Duration
	// Poll is the interval between observations while waiting or watching.
	Poll time.Duration
}

Timings are how long the checks wait on the scheduler. A real cluster needs longer than the memory adapter, whose changes are visible at once.

Jump to

Keyboard shortcuts

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