pgsql: Refactor background psql TAP functions

From: Daniel Gustafsson <dgustafsson(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Refactor background psql TAP functions
Date: 2023-04-07 20:21:44
Message-ID: E1pksad-001uk0-CL@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Refactor background psql TAP functions

This breaks out the background and interactive psql functionality into a
new class, PostgreSQL::Test::BackgroundPsql. Sessions are still initiated
via PostgreSQL::Test::Cluster, but once started they can be manipulated by
the new helper functions which intend to make querying easier. A sample
session for a command which can be expected to finish at a later time can
be seen below.

my $session = $node->background_psql('postgres');
$bsession->query_until(qr/start/, q(
\echo start
CREATE INDEX CONCURRENTLY idx ON t(a);
));
$bsession->quit;

Patch by Andres Freund with some additional hacking by me.

Author: Andres Freund <andres(at)anarazel(dot)de>
Reviewed-by: Andrew Dunstan <andrew(at)dunslane(dot)net>
Discussion: https://postgr.es/m/20230130194350.zj5v467x4jgqt3d6@awork3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/664d757531e11ea5ef6971884ddb2a7af6fae69a

Modified Files
--------------
contrib/amcheck/t/003_cic_2pc.pl | 70 ++---
src/bin/psql/t/010_tab_completion.pl | 28 +-
src/test/perl/PostgreSQL/Test/BackgroundPsql.pm | 299 +++++++++++++++++++++
src/test/perl/PostgreSQL/Test/Cluster.pm | 79 ++----
.../recovery/t/010_logical_decoding_timelines.pl | 1 -
src/test/recovery/t/031_recovery_conflict.pl | 102 ++-----
src/test/subscription/t/015_stream.pl | 51 ++--
7 files changed, 388 insertions(+), 242 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2023-04-07 20:30:50 pgsql: Improve IO accounting for temp relation writes
Previous Message Alvaro Herrera 2023-04-07 18:42:25 pgsql: Fix underspecified sort order in test query