TEST_SCHEMA switching in test/install - #28
Conversation
|
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:
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 |
Code reviewFound 2 high-signal issues: 1. CLAUDE.md violation —
|
90fad56 to
c07d4ca
Compare
fecdde5 to
c48f176
Compare
bb72303 to
6e33854
Compare
6e33854 to
cdace49
Compare
test/install/load.sql now reads the count_nulls.test_schema GUC (set via
the Makefile's TEST_SCHEMA var, propagated via PGOPTIONS) to decide whether
to CREATE SCHEMA/SET search_path before installing - empty means no
targeting at all, non-empty explicitly targets that schema, matching
TEST_SCHEMA=Quoted locally.
test/sql/extension_tests.sql's test__check_ncs and test__shutdown__drop_all
gain a schema_hint parameter (defaulted from the same GUC) so they can
assert against a known target when TEST_SCHEMA is non-empty, and skip the
schema-drop when it's empty (nothing to drop). This relies on
test/core/functions.sql already producing schema-invariant assertion
descriptions (see the prior PR) so a single test/expected/extension_tests.out
still matches both legs.
One unavoidable, genuine exception: test__shutdown__drop_all drops the
schema TEST_SCHEMA created - real, different, correct behavior between
"there's a schema to clean up" and "there isn't". Handled via pg_regress's
native numbered-alternate mechanism - test/expected/extension_tests_1.out,
captured from a real TEST_SCHEMA=Quoted run - documented in
test/README.md's scenario writeup.
Crossed the `test` CI job with TEST_SCHEMA={"", Quoted}.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Per a review pass against Postgres-Extensions/cat_tools' own experience (test-fixes.md item 6, found while syncing that repo to pgxntool 2.3.0): a schema name is just an input value the SAME assertions run against in the SAME environment, not a real isolation/environment boundary (unlike PostgreSQL major - different binaries, different container - or pg_tle deployment, which must never share a runner with a filesystem install). Crossing it into the CI matrix only multiplies job count for zero added confidence per dollar. Added test-schema-all: loops TEST_SCHEMA through every value via sequential recursive $(MAKE) calls (same pattern test-update already uses for the load-mode axis), exit 1 on the first failure so a later iteration can't mask an earlier one, each iteration echoed so a failure's TEST_SCHEMA value is still directly attributable without a separate CI check name per value. The `test` CI job now calls this once per PostgreSQL major instead of crossing pg x schema - job count for this job drops back to one per PG major. Verified locally against PG17: both TEST_SCHEMA values pass via `make test-schema-all`. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…nches Per review: we either expect the schema count_nulls is installed into to be in search_path, or we don't - and in this file we never do, in either leg. functions.sql unconditionally sets search_path to exclude count_nulls' own schema (see the header comment above), whether that's the empty leg's 'public' or the TEST_SCHEMA leg's known target - so the membership check's expected value is unconditionally false, not conditional on schema_hint at all. Drops the previous skip()-based two-branch design (which only ran a real assertion in the TEST_SCHEMA leg and skipped it entirely in the empty leg) and the is(ncs(), s) check (a separate "did TEST_SCHEMA target correctly" concern, not a "is it in search_path" concern). s is still real, independently-determined content (via ncs() when there's no fixed target, via schema_hint when there is), so this isn't a tautology - it fails for real if functions.sql's search_path exclusion or load.sql's schema targeting ever breaks. Regenerated test/expected/extension_tests.out and _1.out via make results for both TEST_SCHEMA legs (empty, Quoted) - verified via make test-schema-all. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Document why these two search_path checks aren't redundant: this one doesn't guard against some other test mutating search_path mid-suite. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…raph The prior cross-reference was folded into the end of an existing sentence, easy to miss when skimming the block; call it out as its own labeled paragraph instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
deps.sql now carries a fuller explanation of why it's empty and kept; avoid duplicating that here. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
cdace49 to
32e3429
Compare
test/install/load.sql now reads the count_nulls.test_schema GUC (set via the Makefile's TEST_SCHEMA var, propagated via PGOPTIONS) to decide whether to CREATE SCHEMA/SET search_path before installing - empty means no targeting at all, non-empty explicitly targets that schema, matching TEST_SCHEMA=Quoted locally.
test/sql/extension_tests.sql's test__check_ncs and test__shutdown__drop_all gain a schema_hint parameter (defaulted from the same GUC) so they can assert against a known target when TEST_SCHEMA is non-empty, and skip the schema-drop when it's empty (nothing to drop). This relies on test/core/functions.sql already producing schema-invariant assertion descriptions (see #46) so a single test/expected/extension_tests.out still matches both legs.
test__check_ncs runs a single unconditional assertion rather than two skip()'d branches: we either expect count_nulls' own schema to be in search_path, or we don't - and in this file we never do, in either leg, since functions.sql unconditionally excludes it from search_path regardless of TEST_SCHEMA. The expected value is unconditionally false; the schema being checked (s) is still real, independently-determined content, so this isn't a tautology.
One unavoidable, genuine exception: test__shutdown__drop_all drops the schema TEST_SCHEMA created - real, different, correct behavior between "there's a schema to clean up" and "there isn't". Handled via pg_regress's native numbered-alternate mechanism - test/expected/extension_tests_1.out, captured from a real TEST_SCHEMA=Quoted run - documented in test/README.md's scenario writeup.
Crossed the
testCI job with TEST_SCHEMA={"", Quoted}, then collapsed that back out of the CI matrix into a make-level loop (test-schema-all) since a schema name is just an input value the same assertions run against in the same environment, not a real isolation boundary.Verified via make test-schema-all for both TEST_SCHEMA legs against PG17.