Add full update+upgrade test harness (TEST_LOAD_SOURCE/TEST_SCHEMA, bin/test_existing, pg-upgrade-test/extension-update-test) - #23
Conversation
…in/test_existing, pg-upgrade-test/extension-update-test CI jobs) pgxntool-update's PR #11 built this against an older base and was never reconciled with master, which has since gained the stable-version flip, RELEASE.md, pgxntool 2.2.0, and pg-tle-test - so it sat unmerged. This forward-ports that work onto current master: test/deps.sql now installs fresh/update/existing via the TEST_LOAD_SOURCE GUC and targets a schema (or none) via TEST_SCHEMA, bin/test_existing centralizes the install->guard->update/upgrade->assert->run-suite flow used by two new CI jobs (extension-update-test for ALTER EXTENSION UPDATE, pg-upgrade-test for a real binary pg_upgrade), and a changes job derives the PG-major matrix once for every job (including the existing pg-tle-test) instead of each hardcoding its own list. Adds bin/compare_fresh_vs_update, run automatically in extension-update-test, to structurally diff every object the extension owns between a fresh install and an updated one - something the fixed pgTAP suite alone can't catch. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
CI is fully green: all 51 checks passed, including the real binary |
|
Superseded by a phased stacked-PR redesign that adopts pgxntool's |
PR #11 built count_nulls' extension-update/pg_upgrade test harness against a
branch base that predates the stable-version flip (#13), RELEASE.md (#12),
pgxntool 2.2.0 (#17), and pg-tle-test (#16) - so it landed on the
pgxntool-updatebranch instead ofmaster, and the two branches werenever reconciled. This forward-ports that work onto current
master.What changed, mechanically:
test/deps.sqlnow installs the extensionfresh, via an in-place
ALTER EXTENSION UPDATEfrom 0.9.6, or asserts it'salready installed (a real
pg_upgrade/out-of-band update) - selected by theTEST_LOAD_SOURCEGUC - and separately targets a schema (or none at all)via
TEST_SCHEMA, both propagated from the Makefile throughPGOPTIONS.bin/test_existingcentralizes the install -> plant dependency guard ->update/upgrade -> assert -> run-suite flow shared by two new CI jobs:
extension-update-test(ALTER EXTENSION UPDATE, no pg_upgrade) andpg-upgrade-test(a real binarypg_upgradeacross PostgreSQL majors). Achangesjob derives the supported-PostgreSQL-major list once, gates allfour heavy jobs (including the existing
pg-tle-test) on doc-only pushes,and
all-checks-passedgives branch protection one stable required checkname instead of per-matrix-cell ones.
Verified locally against this container's live PG17 (and confirmed PG12
availability for the CI matrix's older leg):
make test,make test-update,both crossed with
TEST_SCHEMA=Quoted, plus a livebin/test_existing update-scenariorun (empty and Quoted schema) all pass,including the dependency guard correctly blocking a non-CASCADE
DROP EXTENSIONand the version check now correctly comparing againststablerather than a stale numeric version. Did not run a realpg_upgradelocally - this container's PG12/PG17 clusters are persistentshared dev infrastructure, not disposable, so that leg is left for CI's
ephemeral containers to exercise first.
What this took from cat_tools (via pgxntool-update / PR #11), what changed, what's new
Taken essentially verbatim (already true of PR #11, carried forward
unchanged): the
TEST_LOAD_SOURCE/TEST_SCHEMAGUC-propagation mechanism,the dependency-guard technique (plant + actively prove a blocked
non-CASCADE drop, re-prove after every step),
bin/test_existing'ssubcommand structure, the
changesjob's docs-only gate and single-sourcePG-major derivation, and the numbered-alternate-expected-file handling for
TEST_SCHEMA's three genuinely-different landing scenarios (documented intest/README.md's scenario table, not just left as "these differ").count_nulls needs no bridge-update leg and no
omit_columnfix - it hasalways been pure SQL functions with no
SELECT *-over-catalog views, so itnever accumulated the pg_upgrade-unsafe old versions those exist for.
Adapted, and worth flagging as the one real functional bug this forward-port
had to fix:
bin/test_existing's version check compared againstprint-PGXNVERSION(the PGXN distribution version). That was correct whenPR #11 was written, but
masterhas since flippeddefault_versionto theliteral
stablepseudo-version (#13) - PGXNVERSION is still a real number(currently 1.0.0), so every version assertion would have failed comparing
installed=stableagainstexpected=1.0.0. Fixed toprint-EXTENSION_count_nulls_VERSION(the control file's actualdefault_version), matching the same distinction the existingpg-tle-testjob already had to make for the same reason. Also added the second
DATA += sql/count_nulls--0.9.6.sqlMakefile line alongside the existing--1.0.0.sqlone -master's stable-version work already worked aroundpgxntool's
DATAwildcard gap (Postgres-Extensions/pgxntool#48) for theoutgoing current version; the update tests need the same workaround for the
oldest version they install from.
Invented, not in PR #11 or cat_tools' own PR #16:
bin/compare_fresh_vs_update, wired intoextension-update-testas anautomatic CI step. The doc this work is based on (§9) notes cat_tools found
a real update-script bug this way in PR #46 - a pre-0.2.2 update path left
EXECUTE PROCEDUREhardcoded where fresh installs already usedEXECUTE FUNCTION- but only as a manual, uncommitted, one-off diff. Thiscommits that technique as reusable tooling: it installs fresh and
0.9.6-then-updated copies in scratch databases and diffs
pg_get_functiondef/comments/ACLs for every object the extension owns(discovered live via
pg_depend, not a hardcoded object list), so it stayscorrect if count_nulls grows new functions later. Ran clean both schema
legs locally - count_nulls' own update path has no such divergence today,
but the check itself is what's new, not the (currently negative) result.
Skipped, deliberately, not forgotten: centralizing the load-mode switch
into pgxntool's
test/install/(a single committed-once installer, percat_tools'
test/install/load.sql) instead of count_nulls' currentper-test-file
test/deps.sql. Already flagged as a TODO intest/core/functions.sql- a real, independent argument regardless of thisPR, just out of scope for a forward-port. Also left the
every-major stepwise
pg-upgrade-stepwiseclimb job unbuilt: count_nullshas no catalog-touching views/functions, so the two big-jump
pg-upgrade-testlegs already cover the risk that job exists for.
🤖 Generated with Claude Code