Refactor background psql TAP functions
Daniel Gustafsson <dgustafsson@postgresql.org>
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@anarazel.de>
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Discussion: https://postgr.es/m/20230130194350.zj5v467x4jgqt3d6@awork3.anarazel.de
Files
| Path | Change | +/− |
|---|---|---|
| contrib/amcheck/t/003_cic_2pc.pl | modified | +23 −47 |
| src/bin/psql/t/010_tab_completion.pl | modified | +7 −21 |
| src/test/perl/PostgreSQL/Test/BackgroundPsql.pm | added | +299 −0 |
| src/test/perl/PostgreSQL/Test/Cluster.pm | modified | +16 −63 |
| src/test/recovery/t/010_logical_decoding_timelines.pl | modified | +0 −1 |
| src/test/recovery/t/031_recovery_conflict.pl | modified | +28 −74 |
| src/test/subscription/t/015_stream.pl | modified | +15 −36 |
Discussion
- Making background psql nicer to use in tap tests 60 messages · 2023-01-30 → 2024-07-01