By: Tom Sydney Kerckhove <syd@cs-syd.eu>
Self-contained sanity-check specs; no TemplateDB in caller's outer
sqitchPostgresqlSpec and sqitchPersistentPostgresqlSpec no longer
require the caller to thread a TemplateDB through its outer-type stack
or to supply a ConnectionPool. Each check allocates a fresh empty
postgres database internally (its own server, user, and DB) and tears
it down on return. Phase 1 of the schema-equality check uses a second
fresh database, so the persistent baseline and the sqitch deploy are
isolated.
Spec combinator API:
Before:
sqitchPostgresqlSpec :: SqitchSettings
-> TestDef (TemplateDB ': outers) ConnectionPool
-> TestDef outers a
sqitchPostgresqlSpec' :: HContains outers TemplateDB
=> SqitchSettings
-> TestDef outers ConnectionPool
-> TestDef outers ConnectionPool
After:
sqitchPostgresqlSpec :: SqitchSettings
-> TestDef outers a
-> TestDef outers a
Same shape for sqitchPersistentPostgresqlSpec. The `'` variants are
removed; the spec combinator is now its own self-contained describe
block that callers compose with anything.
IO entry points take Postgres.Options rather than TemplateDB +
ConnectionPool:
runSqitchPerChangeChecks :: SqitchSettings -> Postgres.Options -> IO ()
runSqitchWholePlanCycle :: SqitchSettings -> Postgres.Options -> IO ()
runSqitchPersistentChecks :: SqitchPersistentSettings -> Postgres.Options -> IO ()
To support this, sydtest-persistent-postgresql 0.4.0.0 exports four
new building blocks: postgresqlServerSetupFunc, postgresqlUserSetupFunc,
postgresqlDatabaseSetupFunc, postgresqlPoolSetupFunc (these renamed
from internal-only adminDBSetupFunc/tempUserSetupFunc/
tempNewDatabaseSetupFunc/dbConnectionOptionsPoolSetupFunc); plus
emptyPostgresOptionsSetupFunc and emptyPostgresPoolSetupFunc that
chain them into "fresh empty database, returned as Postgres.Options or
as ConnectionPool".
sqitchTargetFromTemplateDB was replaced by sqitchTargetFromOptions
which builds a sqitch --target URI directly from Postgres.Options
(handling unix-socket hosts via URL-encoding as before).
Test fixtures and call sites updated. nix-ci-leader-database's
PostgreSQLSpec.hs needs a follow-up commit on the nix-ci side to
match.
| Time to Start | Worker time | Duration | Time to finish | |
| Config | 0s | 3s | 3s | 3s |
| Eval | 5s | 43s | 43s | 48s |
| Build | 10s | 50s | 29s | 39s |
| Test | - | - | - | - |
| Deploy | - | - | - | - |
| Suite | 0s | 1m37s | 48s | 48s |