Skip to content

Phase 1: adopt test/install, decoupling installation from the test suite - #27

Open
jnasbyupgrade wants to merge 1 commit into
phase0-pgxntool-2.3.0from
phase1-test-install
Open

Phase 1: adopt test/install, decoupling installation from the test suite#27
jnasbyupgrade wants to merge 1 commit into
phase0-pgxntool-2.3.0from
phase1-test-install

Conversation

@jnasbyupgrade

Copy link
Copy Markdown
Contributor

Stacked on #25 (pgxntool 2.3.0 bump). First of several phases adding update+upgrade (U&U) test coverage - see pgxntool/README.asc's `test/install` and "Update & Upgrade (U&U) Testing" sections, which this follows directly (and which, worth noting, cites this repo's own prior `test/sql/extension_tests.sql` at an old commit as a schema-targeting example, with an explicit caveat against copying its plpgsql-function-based assertion style - a caveat this redesign takes seriously).

What changed

  • `test/install/load.sql`: installs count_nulls once, committed, before the main `test/sql/` schedule - replacing each test file's own per-test `CREATE EXTENSION` via `test/deps.sql`. Its own output isn't tracked (see `test/install/.gitignore`) - pg_regress resolves its expected/actual paths to the same file, so the diff is always self-identical regardless of content; correctness comes from the SQL itself failing loudly, not a textual comparison (matching cat_tools' own `test/install/load.sql`).
  • Retired the old ad hoc pattern where each test file hardcoded its own literal schema name (`\set schema ...`) as a stand-in for schema-qualification coverage. `test/sql/simple.sql` (same assertions as `extension_tests.sql`, just a different hardcoded schema) is now a strict subset once there's one canonical install location - removed. `test/sql/sanity.sql`'s own bare `CREATE EXTENSION` would now conflict with test/install's already-committed install anyway, and its coverage was already a subset of `test__functionality` - removed too.
  • `test/core/functions.sql`/`test/sql/extension_tests.sql`: dropped the now-undefined `:schema` psql variable references; simplified `test__check_ncs`/`test__shutdown__drop_all` to not assume a specific hardcoded target (a future schema-targeting phase will make these real assertions again).

Fresh-only, no schema targeting yet - deliberately scoped small. Schema-switching and update/upgrade mode selection are follow-up phases, stacked on this one.

Notable side effect

Since `test/install` runs in its own bare connection (not the in-suite session pgTAP's own `tap_setup.sql` runs in, which normally puts pgTAP's schema on `search_path` first), an untargeted `CREATE EXTENSION` now lands in `public` instead of pgTAP's own schema. This is actually a simplification: it's now the only possible landing location for "no schema specified," which incidentally forecloses a source of expected-output divergence between entry points (in-suite vs. an external bare-psql install) that a schema-targeting phase would otherwise have had to handle as a separate case.

Verification

`make test` / `make verify-results` pass against this container's live PG17 (2/2: `../install/load`, `extension_tests`).

…suite

Per pgxntool/README.asc's test/install and Update & Upgrade (U&U) Testing
sections: count_nulls is now installed once, committed, by
test/install/load.sql before the main test/sql/ schedule runs, instead of
each test file doing its own CREATE EXTENSION via test/deps.sql. This is
phase 1 of several - fresh-only, no schema targeting yet (that's a
follow-up) - laying the foundation update/upgrade testing needs: test/install
runs in its own committed session, so a later ALTER EXTENSION UPDATE there
can actually commit, unlike inside test/deps.sql's per-test rolled-back
transaction.

Retires the old ad hoc pattern where each test file hardcoded its own
literal schema name (\set schema ...) as a stand-in for real
schema-qualification coverage. test/sql/simple.sql is now a strict subset
of extension_tests.sql (same assertions, same install) and test/sql/sanity.sql's
own bare CREATE EXTENSION would now conflict with test/install's already-committed
install - both removed; their behavioral coverage was already redundant
with test__functionality.

Side effect worth noting: since test/install runs in its own bare
connection (not the in-suite session tap_setup.sql runs in), the extension
now lands in 'public' rather than pgTap's own schema - this is the ONLY
landing location for an untargeted install now, which incidentally
eliminates a source of expected-output divergence between entry points
that a schema-targeting phase would otherwise have needed to handle
separately.

Verified: make test / make verify-results pass against PG17.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cb6278ef-3133-4a96-b1bf-01e529c9e4ab

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant