Documentation
¶
Overview ¶
Package provider is the provider conformance suite: one scenario set run against every provider's fake (spec 11).
Index ¶
- Variables
- func RunAll(t *testing.T, tg Target, newH func(*testing.T) *harness.H)
- func RunFB15(t *testing.T, tg Target, newH func(*testing.T) *harness.H)
- func RunPS1(t *testing.T, tg Target, h *harness.H)
- type APICall
- type CallRecorder
- type Expirer
- type Lister
- type Nouner
- type Scenario
- type Spender
- type TailRecoverer
- type Target
- type Tripper
Constants ¶
This section is empty.
Variables ¶
var Scenarios []Scenario
Scenarios is extended by later tasks (cap, breaker, restart, interrupt, sweep, artifacts...).
Functions ¶
func RunFB15 ¶
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.
Types ¶
type APICall ¶
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 ¶
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 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.