pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Don't propagate PGAPPNAME through pg_ctl in tests
Date: Sat, 16 Mar 2019 08:37:03 +0000
Message-ID: <E1h54oR-0002BU-NR@gemulon.postgresql.org> (raw)

Don't propagate PGAPPNAME through pg_ctl in tests

When libpq is loaded in the server (for instance, by
libpqwalreceiver), it may use libpq environment variables set in the
postmaster environment for connection parameter defaults.  This has
some confusing effects in our test suites.  For example, the TAP test
infrastructure sets PGAPPNAME to allow identifying clients in the
server log.  But this environment variable is also inherited by
temporary servers started with pg_ctl and is then in turn used by
libpqwalreceiver as the application_name for connecting to remote
servers where it then shows up in pg_stat_replication and is relevant
for things like synchronous_standby_names.  Replication already has a
suitable default for application_name, and overriding that
accidentally then requires the individual test cases to re-override
that, which is all very confusing and unnecessary.

To fix, unset PGAPPNAME temporarily before running pg_ctl start or
restart in the tests.

More comprehensive approaches like unsetting all environment variables
in pg_ctl were considered but might be too complicated to achieve
portably.

The now unnecessary re-overriding of application_name by test cases is
also removed.

Reviewed-by: Noah Misch <noah@leadboat.com>
Discussion: https://www.postgresql.org/message-id/flat/33383613-690e-6f1b-d5ba-4957ff40f6ce@2ndquadrant.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8e93a516e68bac3c329fd2e7f423ee9aceca943a

Modified Files
--------------
src/bin/pg_rewind/t/RewindTest.pm          |  4 ++--
src/test/perl/PostgresNode.pm              | 34 ++++++++++++++++++++++++------
src/test/recovery/t/004_timeline_switch.pl |  2 +-
src/test/subscription/t/001_rep_changes.pl | 27 ++++++++++++------------
src/test/subscription/t/002_types.pl       | 13 ++++++------
src/test/subscription/t/003_constraints.pl | 11 +++++-----
src/test/subscription/t/004_sync.pl        | 15 ++++++-------
src/test/subscription/t/005_encoding.pl    |  7 +++---
src/test/subscription/t/006_rewrite.pl     | 11 +++++-----
src/test/subscription/t/007_ddl.pl         |  5 ++---
src/test/subscription/t/008_diff_schema.pl | 11 +++++-----
src/test/subscription/t/009_matviews.pl    |  7 +++---
src/test/subscription/t/010_truncate.pl    |  6 +++---
13 files changed, 82 insertions(+), 71 deletions(-)



Message-ID: <E1h54oR-0002BU-NR@gemulon.postgresql.org>
Permalink:  ../E1h54oR-0002BU-NR@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1h54oR-0002BU-NR@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: peter@eisentraut.org
  Subject: Re: pgsql: Don't propagate PGAPPNAME through pg_ctl in tests
  In-Reply-To: <E1h54oR-0002BU-NR@gemulon.postgresql.org>
  References: <E1h54oR-0002BU-NR@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