contracttest

package
v0.0.14-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 7 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 contracttest runs shared lifecycle assertions against real adapters backed by controlled native transports. It is test support only.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertObservation

func AssertObservation(t *testing.T, got sandbox.Info, err error, reference sandbox.Reference, providerID, state string)

AssertObservation checks identity and the expected native state, without equating a running process with authenticated Runtime or executor readiness.

func RunFailures

func RunFailures(t *testing.T, factory Factory)

RunFailures requires errors without mandating one native error type. Failed or canceled calls must not invent proof of settlement or bootstrap completion.

Types

type Factory

type Factory func(t *testing.T, scenario Scenario, cancel context.CancelFunc) Fixture

Factory configures native responses. Invoke cancel only after dispatch begins.

type Fault

type Fault string
const (
	TransportFailure Fault = "transport_failure"
	Canceled         Fault = "canceled_after_dispatch"
	ForeignOwnership Fault = "foreign_ownership"
	CleanupFailure   Fault = "cleanup_failure"
)

type Fixture

type Fixture struct {
	Provider  sandbox.SandboxProvider
	Bootstrap sandbox.Bootstrap
	Calls     func() []string
	WantCalls []string
}

Fixture exposes the production adapter. Calls records all native requests; WantCalls includes legitimate multi-step work before the injected fault. Exact comparison detects replay, fallback and implicit cleanup after uncertain Create.

type Scenario

type Scenario struct {
	Operation string
	Fault     Fault
}

Jump to

Keyboard shortcuts

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