Refactor background psql TAP functions
authorDaniel Gustafsson <[email protected]>
Fri, 7 Apr 2023 20:14:20 +0000 (22:14 +0200)
committerDaniel Gustafsson <[email protected]>
Fri, 7 Apr 2023 20:14:20 +0000 (22:14 +0200)
commit664d757531e11ea5ef6971884ddb2a7af6fae69a
tree981aa632e9732d6ad1d9c9fca09d8bfaeccb878c
parent32bc0d022dee250fac9fc787226abed96b8ff894
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 <[email protected]>
Reviewed-by: Andrew Dunstan <[email protected]>
Discussion: https://postgr.es/m/20230130194350[email protected]
contrib/amcheck/t/003_cic_2pc.pl
src/bin/psql/t/010_tab_completion.pl
src/test/perl/PostgreSQL/Test/BackgroundPsql.pm [new file with mode: 0644]
src/test/perl/PostgreSQL/Test/Cluster.pm
src/test/recovery/t/010_logical_decoding_timelines.pl
src/test/recovery/t/031_recovery_conflict.pl
src/test/subscription/t/015_stream.pl