Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit334f512

Browse files
Add option to specify timeout seconds to BackgroundPsql.pm.
Previously, a background psql session uses the default timeout and itcannot be overridden. This change adds a new option to set the timeoutduring start.There are no users of this new option. It is needed for an upcomingpatch adding tests for XID wraparound.Reviewed-by: Daniel Gustafsson, Noah MischDiscussion:https://postgr.es/m/C9CF2F76-0D81-4C9D-9832-202BE8517056%40yesql.se
1 parenta182756 commit334f512

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

‎src/test/perl/PostgreSQL/Test/BackgroundPsql.pm

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ use Test::More;
6868
6969
=over
7070
71-
=itemPostgreSQL::Test::BackgroundPsql->new(interactive, @params)
71+
=itemPostgreSQL::Test::BackgroundPsql->new(interactive, @psql_params, timeout)
7272
7373
Builds a new object of classC<PostgreSQL::Test::BackgroundPsql> for either
7474
an interactive or background session and starts it. IfC<interactive> is
@@ -81,7 +81,7 @@ string. For C<interactive> sessions, IO::Pty is required.
8181
subnew
8282
{
8383
my$class =shift;
84-
my ($interactive,$psql_params) =@_;
84+
my ($interactive,$psql_params,$timeout) =@_;
8585
my$psql = {
8686
'stdin'=>'',
8787
'stdout'=>'',
@@ -96,8 +96,10 @@ sub new
9696
"Forbidden caller of constructor: package:$package, file:$file:$line"
9797
unless$package->isa('PostgreSQL::Test::Cluster');
9898

99-
$psql->{timeout} =
100-
IPC::Run::timeout($PostgreSQL::Test::Utils::timeout_default);
99+
$psql->{timeout} = IPC::Run::timeout(
100+
defined($timeout)
101+
?$timeout
102+
:$PostgreSQL::Test::Utils::timeout_default);
101103

102104
if ($interactive)
103105
{

‎src/test/perl/PostgreSQL/Test/Cluster.pm

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,8 +2028,6 @@ sub psql
20282028
20292029
InvokeB<psql> onB<$dbname> and return a BackgroundPsql object.
20302030
2031-
A timeout of $PostgreSQL::Test::Utils::timeout_default is set up.
2032-
20332031
psql is invoked in tuples-only unaligned mode with reading ofB<.psqlrc>
20342032
disabled. That may be overridden by passing extra psql parameters.
20352033
@@ -2047,6 +2045,11 @@ By default, the B<psql> method invokes the B<psql> program with ON_ERROR_STOP=1
20472045
set, so SQL execution is stopped at the first error and exit code 3 is
20482046
returned. SetB<on_error_stop> to 0 to ignore errors instead.
20492047
2048+
=itemtimeout => 'interval'
2049+
2050+
Set a timeout for a background psql session. By default, timeout of
2051+
$PostgreSQL::Test::Utils::timeout_default is set up.
2052+
20502053
=itemreplication =>B<value>
20512054
20522055
If set, addB<replication=value> to the conninfo string.
@@ -2068,6 +2071,7 @@ sub background_psql
20682071
local%ENV =$self->_get_env();
20692072

20702073
my$replication =$params{replication};
2074+
my$timeout =undef;
20712075

20722076
my@psql_params = (
20732077
$self->installed_command('psql'),
@@ -2079,12 +2083,13 @@ sub background_psql
20792083
'-');
20802084

20812085
$params{on_error_stop} = 1unlessdefined$params{on_error_stop};
2086+
$timeout =$params{timeout}ifdefined$params{timeout};
20822087

20832088
push@psql_params,'-v','ON_ERROR_STOP=1'if$params{on_error_stop};
20842089
push@psql_params, @{$params{extra_params} }
20852090
ifdefined$params{extra_params};
20862091

2087-
return PostgreSQL::Test::BackgroundPsql->new(0, \@psql_params);
2092+
return PostgreSQL::Test::BackgroundPsql->new(0, \@psql_params,$timeout);
20882093
}
20892094

20902095
=pod

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp