ci: assert extension version dynamically against default_version#37
Open
jnasbyupgrade wants to merge 2 commits into
Open
ci: assert extension version dynamically against default_version#37jnasbyupgrade wants to merge 2 commits into
jnasbyupgrade wants to merge 2 commits into
Conversation
Replace the three hardcoded version greps (`grep -q "0.2.2"`) in the pg-upgrade-test and extension-update-test jobs with a dynamic assertion that compares the installed extversion to the extension's current default_version, both read from PostgreSQL. This makes the update tests release-agnostic: they prove UPDATE/pg_upgrade reaches the current version without needing a hand-edit on every release. Step names are also made version-free. Co-Authored-By: Claude Opus 4.8 <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:
✨ 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 |
The previous approach read EXPECTED from pg_available_extensions.default_version, which comes from the same make install the test is validating. A broken "make extension available" step (wrong control installed, extension not made available) would corrupt both INSTALLED and EXPECTED identically, so the comparison could pass spuriously. Derive EXPECTED from the build instead (make print-EXTENSION_cat_tools_VERSION) so it is authoritative and independent of the database, while remaining release-agnostic. Co-Authored-By: Claude Opus 4.8 <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.
Problem
ci.ymlasserted the extension version with hardcoded string greps likeecho "$VERSION" | grep -q "0.2.2". Three such assertions existed:pg-upgrade-test→ "Verify extension version after upgrade"extension-update-test→ "Test upgrade from 0.2.0…"extension-update-test→ "Test upgrade from 0.2.1…"This forced a hand-edit of the test on every release. The update test's job is to prove that
ALTER EXTENSION … UPDATE(or pg_upgrade) reaches the current version, not to match a frozen literal.Change
Each hardcoded grep is replaced with a dynamic assertion that compares the DB-reported installed version against the version that was built:
Why EXPECTED comes from
make, not the databaseAn earlier revision read
EXPECTEDfrompg_available_extensions.default_version. That value comes from the samemake installthe test is trying to validate. If something went wrong making the extension available to the database (wrong version's control file installed, extension not made available, etc.), thenEXPECTEDwould be derived from that broken state — andINSTALLED == EXPECTEDcould pass spuriously because both sides reflect the same corruption.Deriving
EXPECTEDfrom the build (make print-EXTENSION_cat_tools_VERSION, via pgxntool'sprint-%target) makes it authoritative and independent of the database. The assertion now verifies the DB-reported installed version against the build's source of truth, so it catches a broken or mismatched "make extension available" step that a DB-vs-DB comparison could not. stderr is discarded to drop a pre-existing, unrelated "overriding recipe" make warning.The 0.2.1 case passes
-d cat_tools_from_021(the DB that step uses). Step names are made version-free.This value (0.2.2 today) tracks control's
default_versionand will follow0.2.3then a futurestablepseudo-version, so it stays release-agnostic with no edits. For thepg-upgrade-testleg, EXPECTED is the build's version and pg_upgrade preserves the installed version (that leg does not runALTER EXTENSION … UPDATE).CI-only change; no HISTORY.asc entry.