Documentation
¶
Overview ¶
Package recordertest holds the two conformance suites of the recorder: RunStore holds any recorder.Store to the Store contract (the in-memory store, sqlrecorder on every database, an app's own store), and RunDriver runs a Recorder over any workflow driver through a workflowtest.Harness, so the recorder is proven on memory, SQL, Redis and Hatchet alike.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunDriver ¶
func RunDriver(t *testing.T, h workflowtest.Harness, opts ...DriverOption)
RunDriver runs the recorder over the driver h builds, through only the public seams (workflow.Use with the recorder's plugin), and checks the records it leaves: a run with its source, steps, outputs, events and set outcome; a run that retried and failed with its error history and default outcome; redaction of every stored body and attribute; a delayed run cancelled before it started; and the Reconciler, which backfills a run the recorder never saw, finishes a record whose end it missed and flags one the client does not know. Cases a driver cannot run (no CapDelayedStart, no CapRunQuery) are skipped with the reason.
Only Harness.New, Prefix, Wait and Poll are read; the recorder needs no restart, crash or queue seams.
func RunStore ¶
RunStore runs the Store contract against stores made by newStore: upserts that fill but never overwrite, step attempts, events, outcome, finish and re-open, the join of a delayed run's two IDs, listings with every filter and paging, Pending and MarkChecked, copies on read, concurrent writes, the refusal of malformed writes, and, when the store is a Pruner, the two retention stages with archive.
Types ¶
type DriverOption ¶
type DriverOption func(*driverConfig)
DriverOption configures RunDriver.
func WithStore ¶
func WithStore(newStore NewStore) DriverOption
WithStore makes RunDriver record into stores newStore builds instead of a recorder.MemoryStore, so a store and a driver are proven together (the SQL store next to the SQL driver, say).
type NewStore ¶
type NewStore func(t *testing.T, cfg StoreConfig) recorder.Store
NewStore builds a fresh, empty store for one subtest; cleanup goes on t.
type StoreConfig ¶
type StoreConfig struct {
// Retention is the store's retention.
Retention recorder.Retention
// Clock is the clock the store measures retention ages with.
Clock clock.Clock
}
StoreConfig is what a store under test is built with. A store that has no retention ignores Retention; the prune cases then skip (they run only when the store implements recorder.Pruner).