mirror of
https://github.com/postgres/postgres.git
synced 2025-07-20 05:03:10 +03:00
Add option to specify timeout seconds to BackgroundPsql.pm.
Previously, a background psql session uses the default timeout and it cannot be overridden. This change adds a new option to set the timeout during start. There are no users of this new option. It is needed for an upcoming patch adding tests for XID wraparound. Reviewed-by: Daniel Gustafsson, Noah Misch Discussion: https://postgr.es/m/C9CF2F76-0D81-4C9D-9832-202BE8517056%40yesql.se
This commit is contained in:
@ -68,7 +68,7 @@ use Test::More;
|
||||
|
||||
=over
|
||||
|
||||
=item PostgreSQL::Test::BackgroundPsql->new(interactive, @params)
|
||||
=item PostgreSQL::Test::BackgroundPsql->new(interactive, @psql_params, timeout)
|
||||
|
||||
Builds a new object of class C<PostgreSQL::Test::BackgroundPsql> for either
|
||||
an interactive or background session and starts it. If C<interactive> is
|
||||
@ -81,7 +81,7 @@ string. For C<interactive> sessions, IO::Pty is required.
|
||||
sub new
|
||||
{
|
||||
my $class = shift;
|
||||
my ($interactive, $psql_params) = @_;
|
||||
my ($interactive, $psql_params, $timeout) = @_;
|
||||
my $psql = {
|
||||
'stdin' => '',
|
||||
'stdout' => '',
|
||||
@ -96,8 +96,10 @@ sub new
|
||||
"Forbidden caller of constructor: package: $package, file: $file:$line"
|
||||
unless $package->isa('PostgreSQL::Test::Cluster');
|
||||
|
||||
$psql->{timeout} =
|
||||
IPC::Run::timeout($PostgreSQL::Test::Utils::timeout_default);
|
||||
$psql->{timeout} = IPC::Run::timeout(
|
||||
defined($timeout)
|
||||
? $timeout
|
||||
: $PostgreSQL::Test::Utils::timeout_default);
|
||||
|
||||
if ($interactive)
|
||||
{
|
||||
|
Reference in New Issue
Block a user