Documentation
¶
Overview ¶
Package testseq provides migration-sequence test infrastructure shared by chok's built-in batteries. It is internal so none of this test surface becomes part of the framework API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalJSON ¶
CanonicalJSON decodes and re-encodes JSON so object key order and dialect-specific JSON storage normalization do not affect trace equality.
func EqualTrace ¶
EqualTrace reports whether two normalized traces are identical.
func PrefixFS ¶
PrefixFS copies the common three-dialect prefix ending at upTo into an in-memory filesystem. The caller constructs a new db.Sequence from it with an empty baseline; the production sequence remains opaque and unchanged.
func RunUpgradeMatrix ¶
func RunUpgradeMatrix( t testing.TB, open func(testing.TB) *db.DB, full, prefix db.Sequence, spec UpgradeSpec, )
RunUpgradeMatrix runs a fresh apply, an exact versioned-prefix upgrade, and an optional AutoMigrate-baseline adoption. Every enabled upgrade path must converge to the fresh owned-table fingerprint and behavior trace.
A zero prefix is accepted only for a one-file full sequence. Otherwise the prefix must have the same identity as full and be a strict byte-identical migration prefix; this prevents a future migration from silently leaving P2 disabled or a full sequence from masquerading as an N-1 frontier.
Types ¶
type Observation ¶
type Observation struct {
Step string
Error string
OK bool
Rows int64
Rank int
JSON string
Business string
}
Observation is one normalized behavior result. Keep traces limited to stable categories and relationships: never store generated RIDs, delete tokens, timestamps, driver error strings, or raw auto-increment values.
type Trace ¶
type Trace []Observation
Trace is a deterministic behavior trajectory suitable for cross-database and cross-migration-path comparison.
type UpgradeSpec ¶
type UpgradeSpec struct {
Seed func(testing.TB, *db.DB)
VerifyUpgrade func(testing.TB, *db.DB)
Trace func(testing.TB, *db.DB) Trace
PrepareAdoptable func(testing.TB, *db.DB)
}
UpgradeSpec supplies the data and behavior portions of an upgrade test. Seed and VerifyUpgrade run only on upgrade paths (P2/P3); Trace runs on all enabled paths and is compared with the fresh P1 trajectory.