diff options
author | Masahiko Sawada <msawada@postgresql.org> | 2023-11-30 14:08:34 +0900 |
---|---|---|
committer | Masahiko Sawada <msawada@postgresql.org> | 2023-11-30 14:08:34 +0900 |
commit | 334f512f45ebc946ca1a5aa51808b4447f6384a0 (patch) | |
tree | 4365c4956ed42d38938dcda11ef7e3b893acf787 /src/test/perl/PostgreSQL/Test/Cluster.pm | |
parent | a1827568d22fba9e33044b8cfc5eb19e55ad5488 (diff) | |
download | postgresql-334f512f45ebc946ca1a5aa51808b4447f6384a0.tar.gz postgresql-334f512f45ebc946ca1a5aa51808b4447f6384a0.zip |
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
Diffstat (limited to 'src/test/perl/PostgreSQL/Test/Cluster.pm')
-rw-r--r-- | src/test/perl/PostgreSQL/Test/Cluster.pm | 11 |
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 321b77d7ed2..a020377761d 100644 --- a/src/test/perl/PostgreSQL/Test/Cluster.pm +++ b/src/test/perl/PostgreSQL/Test/Cluster.pm @@ -2028,8 +2028,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. @@ -2047,6 +2045,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. @@ -2068,6 +2071,7 @@ sub background_psql local %ENV = $self->_get_env(); my $replication = $params{replication}; + my $timeout = undef; my @psql_params = ( $self->installed_command('psql'), @@ -2079,12 +2083,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 |