← ClaudeAtlas

testinglisted

Pick the right PostgreSQL test flavor for a core / contrib patch — covers pg_regress .sql / .out pairs, isolationtester specs and permutations for concurrency / deadlock races, TAP (PostgreSQL::Test::Cluster) for multi-node and pg_basebackup / replication / recovery scenarios, and src/test/modules for in-tree C test modules. Spans where test files live, how to wire them into the right schedule / meson.build, and how to run a single test fast (REGRESS_OPTS, --temp-instance, PROVE_FLAGS). Use whenever adding tests to a PG patch, reviewing a patch's test coverage, picking between regress / isolation / TAP for a new feature, debugging a regression diff, or asked "where should the test for X live". Skip for pytest / unittest / Jest / Vitest / Mocha / RSpec / JUnit / Go testing / Rust cargo-test app testing, pgbench / sysbench / HammerDB performance benchmarking, end-to-end / Selenium / Playwright web testing, and load / stress testing of production PG.
matejformanek/postgres-claude · ★ 0 · Testing & QA · score 70
Install: claude install-skill matejformanek/postgres-claude
# Testing PostgreSQL — decision tree Companion to `knowledge/conventions/testing.md`. That file is the long-form reference; this is the action card. ## Step 1: Pick the flavor Answer these in order. **First "yes" wins.** 1. **Does the behavior need multiple sessions / concurrent transactions / heavyweight-lock contention?** → **isolation spec** in `source/src/test/isolation/specs/<name>.spec`. Caveat: `isolationtester` only sees heavyweight locks via `pg_locks`. LWLock / buffer-pin contention → use `source/src/test/modules/injection_points/` (or a custom C test module) instead. Minimal spec grammar: ``` setup { CREATE TABLE t (a int); } teardown { DROP TABLE t; } session "s1" { step "s1a" { BEGIN; } step "s1b" { COMMIT; } } session "s2" { step "s2a" { SELECT * FROM t; } } permutation "s1a" "s2a" "s1b" ``` When any step blocks, the `permutation` line is **mandatory** — auto-generated permutations will hang CI. 2. **Does it need initdb, a restart, multiple clusters, replication, a backup, a signal, or testing a CLI tool (`pg_dump`, `pg_basebackup`, `pg_rewind`)?** → **TAP test** in the appropriate `t/` dir: - Recovery / replication → `source/src/test/recovery/t/NNN_name.pl` - Logical replication → `source/src/test/subscription/t/NNN_name.pl` - Auth → `source/src/test/authentication/t/NNN_name.pl` - SSL → `source/src/test/ssl/t/NNN_name.pl` - A specific CLI tool → `source/src/bin/<tool>/t/NNN_name.pl`