jrgemignani commented on code in PR #2364:
URL: https://github.com/apache/age/pull/2364#discussion_r3029278759
##########
Makefile:
##########
@@ -19,6 +19,64 @@ MODULE_big = age
age_sql = age--1.7.0.sql
+# --- Extension upgrade regression test support ---
+#
+# Validates the upgrade template (age--<VER>--y.y.y.sql) by simulating an
+# extension version upgrade entirely within "make installcheck". The test:
+#
+# 1. Builds the install SQL from the INITIAL version-bump commit (the "from"
+# version). This is the age--<CURR>.sql used by CREATE EXTENSION age.
+# 2. Builds the install SQL from current HEAD as a synthetic "next" version
+# (the "to" version). This is age--<NEXT>.sql where NEXT = CURR.minor+1.
+# 3. Stamps the upgrade template with the synthetic version, producing the
+# upgrade script age--<CURR>--<NEXT>.sql.
+# 4. Temporarily installs both synthetic files into the PG extension
directory
+# so that ALTER EXTENSION age UPDATE TO '<NEXT>' can find them.
+# 5. The age_upgrade regression test exercises the full upgrade path: install
+# at CURR, create data, ALTER EXTENSION UPDATE to NEXT, verify data.
+# 6. The test SQL cleans up the synthetic files via a generated shell script.
+#
+# This forces developers to keep the upgrade template in sync: any SQL object
+# added after the version-bump commit must also appear in the template, or the
+# upgrade test will fail (the object will be missing after ALTER EXTENSION
UPDATE).
+#
+# The .so (shared library) is always built from current HEAD, so C-level
changes
+# in the PR are tested by every regression test, not just the upgrade test.
+#
+# Graceful degradation — the upgrade test is silently skipped when:
+# - No git history (tarball build): AGE_VER_COMMIT is empty.
+# - No upgrade template: age--<CURR>--y.y.y.sql does not exist.
+# - A real (git-tracked) upgrade script from <CURR> already exists
+# (e.g., age--1.7.0--1.8.0.sql is committed): the synthetic test is
+# redundant because the real script ships with the extension.
+# Current version from age.control (e.g., "1.7.0")
+AGE_CURR_VER := $(shell grep -oP "default_version = '\K[^']+" age.control
2>/dev/null)
+# Git commit that last changed age.control — the "initial release" commit
+AGE_VER_COMMIT := $(shell git log -1 --format=%H -- age.control 2>/dev/null)
+# Synthetic next version: current minor + 1 (e.g., 1.7.0 -> 1.8.0)
+AGE_NEXT_VER := $(shell echo $(AGE_CURR_VER) | awk -F. '{printf "%s.%s.%s",
$$1, $$2+1, $$3}')
Review Comment:
This is for a synthetic newer version that does not exist. It is solely for
testing the upgrade file.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]