provider

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 12 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 provider is the provider conformance suite: one scenario set run against every provider's fake (spec 11).

Index

Constants

This section is empty.

Variables

View Source
var Scenarios []Scenario

Scenarios is extended by later tasks (cap, breaker, restart, interrupt, sweep, artifacts...).

Functions

func RunAll

func RunAll(t *testing.T, tg Target, newH func(*testing.T) *harness.H)

RunAll runs every scenario the target supports.

func RunFB15

func RunFB15(t *testing.T, tg Target, newH func(*testing.T) *harness.H)

RunFB15 is conformance row FB15: nothing job-specific crosses before the attach call. It needs a fresh sandbox per behaviour (newH), because a call log is cut at its first attach.

func RunPS1

func RunPS1(t *testing.T, tg Target, h *harness.H)

RunPS1 is conformance row PS1: with the fake's list paginated, five jobs with overlapping lifetimes; after each launch, each job's end and each teardown, the provider's list is exactly the fake's live set (no omission, no duplicate, no foreign name).

Types

type APICall

type APICall struct {
	Op     string
	Attach bool
	Data   string
}

APICall is one call a provider's fake saw, in order. Attach marks the call the fake treats as the one that carries job input (spec 8.2, B.1); Data is everything it was sent.

type CallRecorder

type CallRecorder interface {
	// DeclaresAttach reports whether the provider under test declares `attach` (Caps.FallbackUntil).
	DeclaresAttach() bool
	APICalls(t *testing.T) []APICall
	// Canaries returns the job-specific values (B, K, M, ...) the target's sandbox generated.
	Canaries(t *testing.T) []string
}

CallRecorder is a target whose fake records its calls in order, with the attach call marked.

type Expirer

type Expirer interface {
	AddExpired(t *testing.T, h *harness.H) (id string)
}

Expirer is a target that can list an expired resource of this install, tagged as its own.

type Lister

type Lister interface {
	ListNames(t *testing.T, h *harness.H) []string
	LiveNames(t *testing.T) []string
}

Lister is a target that can ask the provider under test for its list of live resources and read the fake's own live set.

type Nouner

type Nouner interface{ Noun() string }

Nouner is a target whose sweep names a resource by another noun than "resource" ("swept sprite <name>").

type Scenario

type Scenario struct {
	Name string
	Run  func(t *testing.T, h *harness.H, tg Target)
}

Scenario is one named check run against a Target.

type Spender

type Spender interface {
	SetSpend(t *testing.T, h *harness.H, usd float64)
}

Spender is a target whose fake reports today's spend.

type TailRecoverer

type TailRecoverer interface{ RecoversTail() }

TailRecoverer marks a target whose provider re-reads a dropped log tail by offset, so the output is whole and the host has nothing to report.

type Target

type Target interface {
	Name() string
	// Configure writes host and repo config for a pool "heavy" that goes to this provider.
	Configure(t *testing.T, h *harness.H)
	// Behave sets the fake's next behaviour: "ok", "create-fails" (every create attempt fails,
	// so the job falls back), "setup-fails-after-create" (the resource is created, then setup
	// fails before BEGIN for an infrastructure or unclassified cause),
	// "setup-fails-repo-after-create" (the resource is created, then the repo's own setup step
	// deps fails by itself with the first error line "npm ERR! missing script: ci"), "lost-after-begin",
	// "restart-after-begin", "drop-log-tail", "forge-result", "preattach-fails" (the resource is
	// created, then setup fails before any job input reached it; only a target whose provider
	// declares attach), "paginate-2" (the fake lists in pages of two; a no-op where the fake API
	// does not paginate). A target fails the test on a
	// behaviour it cannot produce.
	Behave(t *testing.T, behaviour string)
	// Calls returns the fake API calls seen so far ("POST /v2/pods", ...).
	Calls() []string
	// TornDown returns the ids of the resources torn down so far.
	TornDown() []string
	// Supports reports whether a scenario applies (by capability).
	Supports(scenario string) bool
}

Target sets up one provider type against its fake in a harness sandbox.

type Tripper

type Tripper interface{ Trip(t *testing.T) int }

Tripper is a target whose breaker counts another failure than "lost after begin" (Sprites counts discarded Sprites): Trip arms one failing job and returns the exit code that job ends with.

Jump to

Keyboard shortcuts

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