mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Introduce PG_TEST_TIMEOUT_DEFAULT for TAP suite non-elapsing timeouts.
Slow hosts may avoid load-induced, spurious failures by setting environment variable PG_TEST_TIMEOUT_DEFAULT to some number of seconds greater than 180. Developers may see faster failures by setting that environment variable to some lesser number of seconds. In tests, write $PostgreSQL::Test::Utils::timeout_default wherever the convention has been to write 180. This change raises the default for some briefer timeouts. Back-patch to v10 (all supported versions). Discussion: https://postgr.es/m/20220218052842.GA3627003@rfd.leadboat.com
This commit is contained in:
@ -18,7 +18,8 @@ my ($node, $result);
|
||||
#
|
||||
$node = get_new_node('CIC_test');
|
||||
$node->init;
|
||||
$node->append_conf('postgresql.conf', 'lock_timeout = 180000');
|
||||
$node->append_conf('postgresql.conf',
|
||||
'lock_timeout = ' . (1000 * $TestLib::timeout_default));
|
||||
$node->start;
|
||||
$node->safe_psql('postgres', q(CREATE EXTENSION amcheck));
|
||||
$node->safe_psql('postgres', q(CREATE TABLE tbl(i int)));
|
||||
|
@ -22,7 +22,8 @@ my ($node, $result);
|
||||
$node = get_new_node('CIC_2PC_test');
|
||||
$node->init;
|
||||
$node->append_conf('postgresql.conf', 'max_prepared_transactions = 10');
|
||||
$node->append_conf('postgresql.conf', 'lock_timeout = 180000');
|
||||
$node->append_conf('postgresql.conf',
|
||||
'lock_timeout = ' . (1000 * $TestLib::timeout_default));
|
||||
$node->start;
|
||||
$node->safe_psql('postgres', q(CREATE EXTENSION amcheck));
|
||||
$node->safe_psql('postgres', q(CREATE TABLE tbl(i int)));
|
||||
@ -38,7 +39,7 @@ $node->safe_psql('postgres', q(CREATE TABLE tbl(i int)));
|
||||
|
||||
my $main_in = '';
|
||||
my $main_out = '';
|
||||
my $main_timer = IPC::Run::timeout(180);
|
||||
my $main_timer = IPC::Run::timeout($TestLib::timeout_default);
|
||||
|
||||
my $main_h =
|
||||
$node->background_psql('postgres', \$main_in, \$main_out,
|
||||
@ -52,7 +53,7 @@ pump $main_h until $main_out =~ /syncpoint1/ || $main_timer->is_expired;
|
||||
|
||||
my $cic_in = '';
|
||||
my $cic_out = '';
|
||||
my $cic_timer = IPC::Run::timeout(180);
|
||||
my $cic_timer = IPC::Run::timeout($TestLib::timeout_default);
|
||||
my $cic_h =
|
||||
$node->background_psql('postgres', \$cic_in, \$cic_out,
|
||||
$cic_timer, on_error_stop => 1);
|
||||
@ -113,9 +114,10 @@ PREPARE TRANSACTION 'persists_forever';
|
||||
));
|
||||
$node->restart;
|
||||
|
||||
my $reindex_in = '';
|
||||
my $reindex_out = '';
|
||||
my $reindex_timer = IPC::Run::timeout(180);
|
||||
my $reindex_in = '';
|
||||
my $reindex_out = '';
|
||||
my $reindex_timer =
|
||||
IPC::Run::timeout($TestLib::timeout_default);
|
||||
my $reindex_h =
|
||||
$node->background_psql('postgres', \$reindex_in, \$reindex_out,
|
||||
$reindex_timer, on_error_stop => 1);
|
||||
|
Reference in New Issue
Block a user