-
Notifications
You must be signed in to change notification settings - Fork 4
Add TEST_SCHEMA test-harness switch #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,52 @@ SET client_min_messages = WARNING; | |
| */ | ||
| \i test/roles.sql | ||
|
|
||
| /* | ||
| * TEST_SCHEMA targeting, independent of the mode selection below. The | ||
| * Makefile always exports cat_tools.test_schema via PGOPTIONS (empty by | ||
| * default); read it WITHOUT missing_ok, same reasoning as test_load_mode. | ||
| * | ||
| * Empty (the default): do nothing -- no CREATE SCHEMA, no SET search_path. | ||
| * CREATE EXTENSION cat_tools below then runs exactly as a brand-new user | ||
| * would type it, landing wherever the session's ambient search_path already | ||
| * resolves. | ||
| * | ||
| * Non-empty: create that schema and SET search_path to it before installing. | ||
| * cat_tools' control file pins schema = 'cat_tools' with relocatable = false, | ||
| * so CREATE EXTENSION ignores search_path for ITS OWN placement -- this does | ||
| * not relocate the extension. What it does prove: the make -> PGOPTIONS -> | ||
| * GUC -> psql quoted-identifier pipeline handles a quoting-requiring schema | ||
| * name (e.g. mixed case) correctly end to end, and that installing while some | ||
| * other, possibly hostile, schema is ambient on search_path doesn't break | ||
| * anything. The DO block below is a real check of that pipeline: a quoting | ||
| * bug (e.g. an unquoted reference silently case-folding) would leave | ||
| * search_path pointing at a schema that was never created -- CREATE SCHEMA | ||
| * would create one name, SET search_path would reference another, and | ||
| * PostgreSQL does not error on a search_path entry that doesn't exist, so | ||
| * nothing downstream would fail loudly without this explicit check. | ||
| */ | ||
| SELECT current_setting('cat_tools.test_schema') AS cat_tools_test_schema \gset | ||
| SELECT :'cat_tools_test_schema' <> '' AS cat_tools_has_schema \gset | ||
|
|
||
| \if :cat_tools_has_schema | ||
| CREATE SCHEMA IF NOT EXISTS :"cat_tools_test_schema"; | ||
| SET search_path = :"cat_tools_test_schema"; | ||
|
|
||
| DO $DO$ | ||
| BEGIN | ||
| IF NOT EXISTS ( | ||
| SELECT 1 FROM pg_namespace WHERE nspname = current_setting('cat_tools.test_schema') | ||
| ) THEN | ||
| RAISE EXCEPTION | ||
| 'TEST_SCHEMA target schema % was not created as named -- quoting bug?' | ||
| , current_setting('cat_tools.test_schema') | ||
| ; | ||
| END IF; | ||
| END | ||
| $DO$; | ||
| \endif | ||
| -- end \if :cat_tools_has_schema | ||
|
|
||
|
Comment on lines
+81
to
+96
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This guard doesn't actually catch the regression its own comment describes, and even if it did, it couldn't fail the test run — two separate problems:
|
||
| /* | ||
| * Mode selection. The Makefile always exports cat_tools.test_load_mode via | ||
| * PGOPTIONS. Read it WITHOUT missing_ok: if the GUC did not propagate (a break | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test-all's first two legs can't actually fail on a regression:$(MAKE) testand$(MAKE) test-update(=$(MAKE) test TEST_LOAD_SOURCE=update) both terminate in pgxntool'sinstallcheck, which is.IGNORE'd — this repo's own CLAUDE.md states exactly this: "make testdoes not return non-zero on test regressions... To actually detect failures, usemake verify-results."test-long's first loop iteration (TEST_SCHEMA="", defaultTEST_LOAD_SOURCE=fresh) already re-covers the fresh-install case via the gatingverify-results, making the$(MAKE) testleg redundant as well as non-gating. The$(MAKE) test-updateleg is the real gap: it's the only update-mode coverage intest-all, and since it never routes throughverify-results, an update-path regression makesmake test-allexit 0 — silently defeating its purpose as a full local pre-push gate.