Documentation
¶
Overview ¶
Package pgtest provisions disposable keyword-profile schemas on the CONTENTKIT_TEST_URL Postgres for integration tests.
Index ¶
- func EmptySchema(t testing.TB, ctx context.Context, pool *pgxpool.Pool) string
- func EnsureExtensions(t testing.TB, ctx context.Context, pool *pgxpool.Pool)
- func Pool(t testing.TB, mutate func(*pgxpool.Config)) *pgxpool.Pool
- func Schema(t testing.TB, ctx context.Context, pool *pgxpool.Pool) string
- func SchemaWith(t testing.TB, ctx context.Context, pool *pgxpool.Pool, lineages ...fs.FS) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmptySchema ¶
EmptySchema creates a disposable schema (dropped on cleanup, its migratekit ledger rows included) for a test that applies a lineage itself.
func EnsureExtensions ¶
EnsureExtensions installs pg_trgm and PGroonga once in public under an advisory lock (CREATE EXTENSION IF NOT EXISTS is not concurrency-safe).
func Schema ¶
Schema creates a disposable schema, applies migrations.Postgres into it the way a host's migrate step does, and drops it on cleanup. The extensions are installed once in public: a schema drop must never take them away from a test running in another package, and CREATE EXTENSION IF NOT EXISTS is not concurrency-safe, so the first install is serialized.
Types ¶
This section is empty.