@@ -36,7 +36,8 @@ PostgreSQL::Test::Cluster - class representing PostgreSQL server instance
3636 my ($stdout, $stderr, $timed_out);
3737 my $cmdret = $node->psql('postgres', 'SELECT pg_sleep(600)',
3838 stdout => \$stdout, stderr => \$stderr,
39- timeout => 180, timed_out => \$timed_out,
39+ timeout => $PostgreSQL::Test::Utils::timeout_default,
40+ timed_out => \$timed_out,
4041 extra_params => ['--single-transaction'],
4142 on_error_die => 1)
4243 print "Sleep timed out" if $timed_out;
@@ -1723,7 +1724,8 @@ e.g.
17231724 my ($stdout, $stderr, $timed_out);
17241725 my $cmdret = $node->psql('postgres', 'SELECT pg_sleep(600)',
17251726 stdout => \$stdout, stderr => \$stderr,
1726- timeout => 180, timed_out => \$timed_out,
1727+ timeout => $PostgreSQL::Test::Utils::timeout_default,
1728+ timed_out => \$timed_out,
17271729 extra_params => ['--single-transaction'])
17281730
17291731will set $cmdret to undef and $timed_out to a true value.
@@ -1897,7 +1899,8 @@ scalar reference. This allows the caller to act on other parts of the system
18971899while idling this backend.
18981900
18991901The specified timer object is attached to the harness, as well. It's caller's
1900- responsibility to select the timeout length, and to restart the timer after
1902+ responsibility to set the timeout length (usually
1903+ $PostgreSQL::Test::Utils::timeout_default), and to restart the timer after
19011904each command if the timeout is per-command.
19021905
19031906psql is invoked in tuples-only unaligned mode with reading of B<.psqlrc >
@@ -1985,9 +1988,10 @@ The process's stdin is sourced from the $stdin scalar reference,
19851988and its stdout and stderr go to the $stdout scalar reference.
19861989ptys are used so that psql thinks it's being called interactively.
19871990
1988- The specified timer object is attached to the harness, as well.
1989- It's caller's responsibility to select the timeout length, and to
1990- restart the timer after each command if the timeout is per-command.
1991+ The specified timer object is attached to the harness, as well. It's caller's
1992+ responsibility to set the timeout length (usually
1993+ $PostgreSQL::Test::Utils::timeout_default), and to restart the timer after
1994+ each command if the timeout is per-command.
19911995
19921996psql is invoked in tuples-only unaligned mode with reading of B<.psqlrc >
19931997disabled. That may be overridden by passing extra psql parameters.
@@ -2303,7 +2307,7 @@ sub connect_fails
23032307Run B<$query > repeatedly, until it returns the B<$expected > result
23042308('t', or SQL boolean true, by default).
23052309Continues polling if B<psql > returns an error result.
2306- Times out after 180 seconds.
2310+ Times out after $PostgreSQL::Test::Utils::timeout_default seconds.
23072311Returns 1 if successful, 0 if timed out.
23082312
23092313=cut
@@ -2321,7 +2325,7 @@ sub poll_query_until
23212325 ' -d' , $self -> connstr($dbname )
23222326 ];
23232327 my ($stdout , $stderr );
2324- my $max_attempts = 180 * 10 ;
2328+ my $max_attempts = 10 * $PostgreSQL::Test::Utils::timeout_default ;
23252329 my $attempts = 0;
23262330
23272331 while ($attempts < $max_attempts )
@@ -2343,8 +2347,8 @@ sub poll_query_until
23432347 $attempts ++;
23442348 }
23452349
2346- # The query result didn't change in 180 seconds. Give up. Print the
2347- # output from the last attempt, hopefully that's useful for debugging.
2350+ # Give up. Print the output from the last attempt, hopefully that's useful
2351+ # for debugging.
23482352 diag qq( poll_query_until timed out executing this query:
23492353$query
23502354expecting this output:
@@ -2657,7 +2661,7 @@ sub wait_for_slot_catchup
26572661
26582662Waits for the contents of the server log file, starting at the given offset, to
26592663match the supplied regular expression. Checks the entire log if no offset is
2660- given. Times out after 180 seconds.
2664+ given. Times out after $PostgreSQL::Test::Utils::timeout_default seconds.
26612665
26622666If successful, returns the length of the entire log file, in bytes.
26632667
@@ -2668,7 +2672,7 @@ sub wait_for_log
26682672 my ($self , $regexp , $offset ) = @_ ;
26692673 $offset = 0 unless defined $offset ;
26702674
2671- my $max_attempts = 180 * 10 ;
2675+ my $max_attempts = 10 * $PostgreSQL::Test::Utils::timeout_default ;
26722676 my $attempts = 0;
26732677
26742678 while ($attempts < $max_attempts )
@@ -2683,7 +2687,6 @@ sub wait_for_log
26832687 $attempts ++;
26842688 }
26852689
2686- # The logs didn't match within 180 seconds. Give up.
26872690 croak " timed out waiting for match: $regexp " ;
26882691}
26892692
0 commit comments