pgsql: Add an enforcement mechanism for global object names in regressi

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add an enforcement mechanism for global object names in regressi
Date: 2019-06-29 15:34:10
Message-ID: E1hhFMg-0006BG-Jd@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add an enforcement mechanism for global object names in regression tests.

In commit 18555b132 we tentatively established a rule that regression
tests should use names containing "regression" for databases, and names
starting with "regress_" for all other globally-visible object names, so
as to circumscribe the side-effects that "make installcheck" could have
on an existing installation.

This commit adds a simple enforcement mechanism for that rule: if the code
is compiled with ENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS defined, it
will emit a warning (not an error) whenever a database, role, tablespace,
subscription, or replication origin name is created that doesn't obey the
rule. Running one or more buildfarm members with that symbol defined
should be enough to catch new violations, at least in the regular
regression tests. Most TAP tests wouldn't notice such warnings, but
that's actually fine because TAP tests don't execute against an existing
server anyway.

Since it's already the case that running src/test/modules/ tests in
installcheck mode is deprecated, we can use that as a home for tests
that seem unsafe to run against an existing server, such as tests that
might have side-effects on existing roles. Document that (though this
commit doesn't in itself make it any less safe than before).

Update regress.sgml to define these restrictions more clearly, and
to clean up assorted lack-of-up-to-date-ness in its descriptions of
the available regression tests.

Discussion: https://postgr.es/m/16638.1468620817@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/54100f5c6052404f68de9ce7310ceb61f1c291f8

Modified Files
--------------
doc/src/sgml/regress.sgml | 105 +++++++++++++++++++++++++------
src/backend/commands/alter.c | 6 ++
src/backend/commands/dbcommands.c | 19 ++++++
src/backend/commands/subscriptioncmds.c | 9 +++
src/backend/commands/tablespace.c | 18 ++++++
src/backend/commands/user.c | 18 ++++++
src/backend/replication/logical/origin.c | 9 +++
src/test/modules/README | 7 +++
8 files changed, 172 insertions(+), 19 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2019-06-29 20:48:12 Re: UCT (Re: pgsql: Update time zone data files to tzdata release 2019a.)
Previous Message Michael Paquier 2019-06-29 02:23:05 pgsql: Remove unnecessary header from be-secure-gssapi.c