pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add an enforcement mechanism for global object names in regressi
Date: Sat, 29 Jun 2019 15:34:10 +0000
Message-ID: <E1hhFMg-0006BG-Jd@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1hhFMg-0006BG-Jd@gemulon.postgresql.org>
Permalink:  ../E1hhFMg-0006BG-Jd@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1hhFMg-0006BG-Jd@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Add an enforcement mechanism for global object names in regressi
  In-Reply-To: <E1hhFMg-0006BG-Jd@gemulon.postgresql.org>
  References: <E1hhFMg-0006BG-Jd@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox