aboutsummaryrefslogtreecommitdiff
path: root/src/test/perl/PostgreSQL/Test/Cluster.pm
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2024-06-27 19:00:59 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2024-06-27 19:00:59 +0300
commit187b8991f70fc3d2a13dc709edd408a8df0be055 (patch)
tree05bcba574b14a34d514353d845e14a912dd4d5e9 /src/test/perl/PostgreSQL/Test/Cluster.pm
parentb8f953d8d7bff6ca5d7fc8cb0f37a9d3d7a7462b (diff)
downloadpostgresql-187b8991f70fc3d2a13dc709edd408a8df0be055.tar.gz
postgresql-187b8991f70fc3d2a13dc709edd408a8df0be055.zip
Backport BackgroundPsql perl test module
Backport the new BackgroundPsql modules and the constructor functions, background_psql() and interactive_psql, to all supported branches. That makes it easier to backpatch tests that use it. BackgroundPsql was introduced in version 16. On version 16, this commit backports just the new timeout argument from master (commit 334f512f45). On older branches, the whole facility. This includes the change to `use warnings FATAL => 'all'`, which we haven't otherwise backported, but it seems good to keep the file identical across branches. Discussion: https://www.postgresql.org/message-id/b7c64f20-ea01-4f15-9088-0cd6832af149@iki.fi
Diffstat (limited to 'src/test/perl/PostgreSQL/Test/Cluster.pm')
-rw-r--r--src/test/perl/PostgreSQL/Test/Cluster.pm11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index 7743ffd544d..74592eba692 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -1972,8 +1972,6 @@ sub psql
Invoke B<psql> on B<$dbname> and return a BackgroundPsql object.
-A timeout of $PostgreSQL::Test::Utils::timeout_default is set up.
-
psql is invoked in tuples-only unaligned mode with reading of B<.psqlrc>
disabled. That may be overridden by passing extra psql parameters.
@@ -1991,6 +1989,11 @@ By default, the B<psql> method invokes the B<psql> program with ON_ERROR_STOP=1
set, so SQL execution is stopped at the first error and exit code 3 is
returned. Set B<on_error_stop> to 0 to ignore errors instead.
+=item timeout => 'interval'
+
+Set a timeout for a background psql session. By default, timeout of
+$PostgreSQL::Test::Utils::timeout_default is set up.
+
=item replication => B<value>
If set, add B<replication=value> to the conninfo string.
@@ -2012,6 +2015,7 @@ sub background_psql
local %ENV = $self->_get_env();
my $replication = $params{replication};
+ my $timeout = undef;
my @psql_params = (
$self->installed_command('psql'),
@@ -2023,12 +2027,13 @@ sub background_psql
'-');
$params{on_error_stop} = 1 unless defined $params{on_error_stop};
+ $timeout = $params{timeout} if defined $params{timeout};
push @psql_params, '-v', 'ON_ERROR_STOP=1' if $params{on_error_stop};
push @psql_params, @{ $params{extra_params} }
if defined $params{extra_params};
- return PostgreSQL::Test::BackgroundPsql->new(0, \@psql_params);
+ return PostgreSQL::Test::BackgroundPsql->new(0, \@psql_params, $timeout);
}
=pod