Add extension upgrade template regression test#2364
Open
jrgemignani wants to merge 1 commit intoapache:masterfrom
Open
Add extension upgrade template regression test#2364jrgemignani wants to merge 1 commit intoapache:masterfrom
jrgemignani wants to merge 1 commit intoapache:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new regression test that simulates an in-place Apache AGE extension upgrade (via the upgrade template) during make installcheck, and updates build/install infrastructure to make upgrade scripts available to ALTER EXTENSION ... UPDATE.
Changes:
- Add
age_upgraderegression test (regress/sql/age_upgrade.sql) with expected output (regress/expected/age_upgrade.out) to validate upgrade-template correctness and post-upgrade data/index integrity. - Update the
Makefileto install real upgrade scripts into$(SHAREDIR)/extension/, generate synthetic “next” version SQL + stamped upgrade SQL for testing, and conditionally include the new regression test.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| Makefile | Adds conditional upgrade-test infrastructure, installs upgrade scripts, and stages synthetic upgrade artifacts for installcheck. |
| regress/sql/age_upgrade.sql | New upgrade regression test that creates graphs/indexes, upgrades the extension, and validates data/index survival. |
| regress/expected/age_upgrade.out | Expected output for the new age_upgrade test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8d51ffa to
9d7d7ea
Compare
Note: This PR was created with AI tools and a human. Add a version-agnostic regression test (age_upgrade) that validates the upgrade template (age--<VER>--y.y.y.sql) works correctly by simulating a full extension version upgrade within "make installcheck". Add full upgrade scripts to the install path (DATA) in the Makefile, excluding template upgrade files. This enables the install to copy all version upgrade files into the PG AGE install. This is needed for ALTER EXTENSION Adjusted installcheck.yaml to allow git commit history for this test. Makefile infrastructure: - Build the install SQL (age--<CURR>.sql) from the initial version-bump commit in git history, so CREATE EXTENSION installs "day-one" SQL while the .so comes from current HEAD — implicitly testing backward compat. - Build a synthetic "next" version (age--<NEXT>.sql) from HEAD and stamp the upgrade template to produce age--<CURR>--<NEXT>.sql. - Add an installcheck prerequisite that temporarily installs both synthetic files into the PG extension directory; a generated cleanup script removes them at the end of the test via \! shell escape. EXTRA_CLEAN catches stragglers on "make clean". - Skip the test automatically when: (a) no git history (tarball builds), (b) no upgrade template exists, or (c) a real upgrade script from the current version is already committed (detected via git ls-files).o Regression test (regress/sql/age_upgrade.sql): - Creates 3 graphs (company, network, routes) with 8 vertex labels, 8 edge labels, 23 vertices, 28 edges, and 4 GIN indexes. - Records integrity checksums (agtype sums), vertex/edge counts, and label counts before the upgrade; repeats all checks after ALTER EXTENSION UPDATE to the synthetic next version. - Verifies structural queries: VLE management chains, circular follow chains, flight distances with edge properties. - Verifies all 4 GIN indexes survive the upgrade via pg_indexes. - Uses ORDER BY on all multi-row queries for deterministic output. - Returns agtype natively (no ::numeric casts) for portability. - Avoids version-dependent output (checks boolean IS NOT NULL instead of printing the version string). - Uses JOIN-based label counts to avoid NULL comparison bugs with the internal _ag_catalog graph. - Cleans up all 3 graphs and restores the default AGE version. modified: Makefile new file: regress/expected/age_upgrade.out new file: regress/sql/age_upgrade.sql modified: .github/workflows/installcheck.yaml
9d7d7ea to
2b5c485
Compare
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.
Note: This PR was created with AI tools and a human.
Add a version-agnostic regression test (age_upgrade) that validates the upgrade template (age----y.y.y.sql) works correctly by simulating a full extension version upgrade within "make installcheck".
Add full upgrade scripts to the install path (DATA) in the Makefile, excluding template upgrade files. This enables the install to copy all version upgrade files into the PG AGE install. This is needed for ALTER EXTENSION
Adjusted installcheck.yaml to allow git commit history for this test.
Makefile infrastructure:
Regression test (regress/sql/age_upgrade.sql):
modified: Makefile
new file: regress/expected/age_upgrade.out
new file: regress/sql/age_upgrade.sql
modified: .github/workflows/installcheck.yaml