testinglisted
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`