pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Refactor routine to find single log content pattern in TAP tests
Date: Fri, 09 Jun 2023 02:57:20 +0000
Message-ID: <E1q7SJU-000rW8-Ab@gemulon.postgresql.org> (raw)

Refactor routine to find single log content pattern in TAP tests

The same routine to check if a specific pattern can be found in the
server logs was copied over four different test scripts.  This refactors
the whole to use a single routine located in PostgreSQL::Test::Cluster,
named log_contains, to grab the contents of the server logs and check
for a specific pattern.

On HEAD, the code previously used assumed that slurp_file() could not
handle an undefined offset, setting it to zero, but slurp_file() does
do an extra fseek() before retrieving the log contents only if an offset
is defined.  In two places, the test was retrieving the full log
contents with slurp_file() after calling substr() to apply an offset,
ignoring that slurp_file() would be able to handle that.

Backpatch all the way down to ease the introduction of new tests that
could rely on the new routine.

Author: Vignesh C
Reviewed-by: Andrew Dunstan, Dagfinn Ilmari Mannsåker, Michael Paquier
Discussion: https://postgr.es/m/CALDaNm0YSiLpjCmajwLfidQrFOrLNKPQir7s__PeVvh9U3uoTQ@mail.gmail.com
Backpatch-through: 11

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a9231fedae7a840433bb8eacc211b8e2b5f8893e

Modified Files
--------------
src/test/perl/PostgresNode.pm               | 15 +++++++++++++++
src/test/recovery/t/019_replslot_limit.pl   | 25 ++++---------------------
src/test/recovery/t/033_replay_tsp_drops.pl | 14 ++------------
3 files changed, 21 insertions(+), 33 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1q7SJU-000rW8-Ab@gemulon.postgresql.org>
Permalink:  ../E1q7SJU-000rW8-Ab@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1q7SJU-000rW8-Ab@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Refactor routine to find single log content pattern in TAP tests
  In-Reply-To: <E1q7SJU-000rW8-Ab@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