Add extension update test via pgxntool test-build#11
Draft
jnasbyupgrade wants to merge 2 commits into
Draft
Conversation
|
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:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
jnasbyupgrade
force-pushed
the
pgxntool-update
branch
from
July 16, 2026 21:47
738cf44 to
04fa85a
Compare
test/build/upgrade.sql is a fast smoke check (via pgxntool 2.1.0's test-build feature): install 0.9.6 (oldest version we ship a full script for) and ALTER EXTENSION UPDATE, rolled back. That alone doesn't prove much — it never runs the actual test suite against the upgraded state. test/deps.sql now selects between installing fresh (current version) or via the upgrade path, based on a count_nulls.test_load_mode GUC the Makefile sets via PGOPTIONS (TEST_LOAD_SOURCE=fresh|upgrade). Since every test file loads deps.sql, `make test-update` reruns the whole existing suite (extension_tests, sanity, simple) against the upgraded install, comparing against the exact same expected/*.out as `make test` — proving the upgrade behaves identically to a fresh install rather than just completing without error. Modeled on cat_tools's test/install/load.sql approach (see their new_functions-pgxntool-2.1.0 branch), adapted to count_nulls's simpler single-file test/deps.sql structure instead of introducing a separate test/install fixture, since count_nulls's suite already installs the extension per test file (into different schemas) rather than once globally. sql/count_nulls--0.9.6.sql isn't picked up by base.mk's DATA wildcard (which only covers upgrade scripts and the current version file), so it's added to DATA explicitly. Filed as a pgxntool bug: Postgres-Extensions/pgxntool#48. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
jnasbyupgrade
force-pushed
the
extension-update-test
branch
from
July 16, 2026 21:49
b11893d to
d2ff70e
Compare
Per the terminology convention: 'update' is extension-level (ALTER EXTENSION UPDATE), 'upgrade' is cluster-level (pg_upgrade) — a separate, not-yet-covered axis. The wrapper target was already called test-update; the mode value and GUC name were the odd one out. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #10 (needs the 1.0.0 bump — updating from 0.9.6 is a no-op until then).
Two complementary pieces, modeled on cat_tools's pattern (now written up generally at
~/advanced-extension-testing.md, reference impl on theirnew_functionsbranch / PR #16, plus CI details on PR #37):test/build/upgrade.sql(pgxntool 2.1.0'stest-buildfeature): a fast smoke check. Installs the oldest version we still ship a full script for (0.9.6), thenALTER EXTENSION count_nulls UPDATE, rolled back. Cheap, fails fast, but only proves the update completes — it never exercises the extension's actual behavior.test/deps.sqlmode toggle: the real coverage.test/deps.sqlis loaded by every test file, and now installs eitherfresh(current version) or via theupdatepath (0.9.6→ALTER EXTENSION UPDATE), selected by acount_nulls.test_load_modeplaceholder GUC that the Makefile sets viaPGOPTIONS(TEST_LOAD_SOURCE=fresh|update, defaultfresh).make test-updatereruns the entire existing suite (extension_tests,sanity,simple) against the updated install, comparing against the sameexpected/*.outused bymake test— proving the update behaves identically to a fresh install, not just that it doesn't error.Terminology note (per the writeup, "the single most common mistake here"): update = extension-level (
ALTER EXTENSION UPDATE); upgrade = cluster-level (pg_upgrade), a separate axis this PR doesn't cover. Variable/GUC names use "update" throughout.This is adapted from cat_tools's
test/install/load.sqlpattern, but count_nulls's suite already installs the extension per test file (into different schemas, to test schema-qualification behavior), rather than once globally — so a sharedtest/installfixture didn't fit cleanly. Thetest/deps.sql-level toggle achieves the same "actually run the suite against the update" goal without restructuring that existing per-file install pattern. The reference implementation's target design also addsTEST_UPDATE_FROM/TEST_UPDATE_TOparameterization and anexistingmode (for testing state left by a realpg_upgrade) — not needed here yet since count_nulls only has one meaningful update floor (0.9.6) and nopg_upgradeCI job exists yet.sql/count_nulls--0.9.6.sqlisn't picked up bybase.mk'sDATAwildcard (only upgrade-diff scripts and the current version file are), so it's added explicitly — filed as a pgxntool bug: Postgres-Extensions/pgxntool#48.Next step (separate PR): wire
make test-updateinto.github/workflows/ci.ymlacross the PG version matrix, following theextension-update-testjob pattern from cat_tools PR #37 (dynamic version assertions read from the build rather than hardcoded, with empty-value guards).Test plan
make testpasses on PG17 and PG12 (fresh mode)make test-updatepasses on PG17, same expected output as fresh mode