Unify PostgresNode's new() and get_new_node() methods

There is only one constructor now for PostgresNode, with the idiomatic
name 'new'. The method is not exported by the class, and must be called
as "PostgresNode->new('name',[args])". All the TAP tests that use
PostgresNode are modified accordingly. Third party scripts will need
adjusting, which is a fairly mechanical process (I just used a sed
script).
pull/68/head
Andrew Dunstan 4 years ago
parent dbfe6e4b17
commit 201a76183e
No known key found for this signature in database
GPG Key ID: 99FA7FCB59FC3B81
  1. 2
      contrib/amcheck/t/001_verify_heapam.pl
  2. 2
      contrib/auto_explain/t/001_auto_explain.pl
  3. 4
      contrib/bloom/t/001_wal.pl
  4. 2
      contrib/test_decoding/t/001_repl_stats.pl
  5. 2
      src/bin/pg_amcheck/t/002_nonesuch.pl
  6. 2
      src/bin/pg_amcheck/t/003_check.pl
  7. 2
      src/bin/pg_amcheck/t/004_verify_heapam.pl
  8. 2
      src/bin/pg_amcheck/t/005_opclass_damage.pl
  9. 4
      src/bin/pg_basebackup/t/010_pg_basebackup.pl
  10. 2
      src/bin/pg_basebackup/t/020_pg_receivewal.pl
  11. 2
      src/bin/pg_basebackup/t/030_pg_recvlogical.pl
  12. 2
      src/bin/pg_checksums/t/002_actions.pl
  13. 2
      src/bin/pg_controldata/t/001_pg_controldata.pl
  14. 2
      src/bin/pg_ctl/t/002_status.pl
  15. 6
      src/bin/pg_ctl/t/003_promote.pl
  16. 2
      src/bin/pg_ctl/t/004_logrotate.pl
  17. 2
      src/bin/pg_dump/t/002_pg_dump.pl
  18. 2
      src/bin/pg_dump/t/003_pg_dump_with_server.pl
  19. 6
      src/bin/pg_dump/t/010_dump_connstr.pl
  20. 2
      src/bin/pg_resetwal/t/001_basic.pl
  21. 2
      src/bin/pg_resetwal/t/002_corrupted.pl
  22. 4
      src/bin/pg_rewind/t/007_standby_source.pl
  23. 6
      src/bin/pg_rewind/t/008_min_recovery_point.pl
  24. 4
      src/bin/pg_rewind/t/RewindTest.pm
  25. 2
      src/bin/pg_verifybackup/t/002_algorithm.pl
  26. 2
      src/bin/pg_verifybackup/t/003_corruption.pl
  27. 2
      src/bin/pg_verifybackup/t/004_options.pl
  28. 2
      src/bin/pg_verifybackup/t/006_encoding.pl
  29. 2
      src/bin/pg_verifybackup/t/007_wal.pl
  30. 2
      src/bin/pgbench/t/001_pgbench_with_server.pl
  31. 2
      src/bin/psql/t/010_tab_completion.pl
  32. 2
      src/bin/scripts/t/010_clusterdb.pl
  33. 2
      src/bin/scripts/t/011_clusterdb_all.pl
  34. 2
      src/bin/scripts/t/020_createdb.pl
  35. 2
      src/bin/scripts/t/040_createuser.pl
  36. 2
      src/bin/scripts/t/050_dropdb.pl
  37. 2
      src/bin/scripts/t/070_dropuser.pl
  38. 2
      src/bin/scripts/t/080_pg_isready.pl
  39. 2
      src/bin/scripts/t/090_reindexdb.pl
  40. 2
      src/bin/scripts/t/091_reindexdb_all.pl
  41. 2
      src/bin/scripts/t/100_vacuumdb.pl
  42. 2
      src/bin/scripts/t/101_vacuumdb_all.pl
  43. 2
      src/bin/scripts/t/102_vacuumdb_stages.pl
  44. 2
      src/bin/scripts/t/200_connstr.pl
  45. 2
      src/test/authentication/t/001_password.pl
  46. 2
      src/test/authentication/t/002_saslprep.pl
  47. 2
      src/test/kerberos/t/001_auth.pl
  48. 2
      src/test/ldap/t/001_auth.pl
  49. 2
      src/test/modules/brin/t/01_workitems.pl
  50. 2
      src/test/modules/commit_ts/t/001_base.pl
  51. 4
      src/test/modules/commit_ts/t/002_standby.pl
  52. 4
      src/test/modules/commit_ts/t/003_standby_2.pl
  53. 2
      src/test/modules/commit_ts/t/004_restart.pl
  54. 2
      src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
  55. 2
      src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
  56. 2
      src/test/modules/test_misc/t/001_constraint_validation.pl
  57. 2
      src/test/modules/test_pg_dump/t/001_base.pl
  58. 80
      src/test/perl/PostgresNode.pm
  59. 2
      src/test/perl/README
  60. 6
      src/test/recovery/t/001_stream_rep.pl
  61. 6
      src/test/recovery/t/002_archiving.pl
  62. 8
      src/test/recovery/t/003_recovery_targets.pl
  63. 10
      src/test/recovery/t/004_timeline_switch.pl
  64. 6
      src/test/recovery/t/005_replay_delay.pl
  65. 2
      src/test/recovery/t/006_logical_decoding.pl
  66. 10
      src/test/recovery/t/007_sync_rep.pl
  67. 4
      src/test/recovery/t/008_fsm_truncation.pl
  68. 4
      src/test/recovery/t/009_twophase.pl
  69. 4
      src/test/recovery/t/010_logical_decoding_timelines.pl
  70. 2
      src/test/recovery/t/011_crash_recovery.pl
  71. 4
      src/test/recovery/t/012_subtransactions.pl
  72. 2
      src/test/recovery/t/013_crash_restart.pl
  73. 2
      src/test/recovery/t/014_unlogged_reinit.pl
  74. 4
      src/test/recovery/t/015_promotion_pages.pl
  75. 4
      src/test/recovery/t/016_min_consistency.pl
  76. 2
      src/test/recovery/t/017_shm.pl
  77. 2
      src/test/recovery/t/018_wal_optimize.pl
  78. 12
      src/test/recovery/t/019_replslot_limit.pl
  79. 6
      src/test/recovery/t/020_archive_status.pl
  80. 4
      src/test/recovery/t/021_row_visibility.pl
  81. 2
      src/test/recovery/t/022_crash_temp_files.pl
  82. 4
      src/test/recovery/t/023_pitr_prepared_xact.pl
  83. 4
      src/test/recovery/t/024_archive_recovery.pl
  84. 6
      src/test/recovery/t/025_stuck_on_old_timeline.pl
  85. 2
      src/test/ssl/t/001_ssltests.pl
  86. 2
      src/test/ssl/t/002_scram.pl
  87. 4
      src/test/subscription/t/001_rep_changes.pl
  88. 4
      src/test/subscription/t/002_types.pl
  89. 4
      src/test/subscription/t/003_constraints.pl
  90. 4
      src/test/subscription/t/004_sync.pl
  91. 4
      src/test/subscription/t/005_encoding.pl
  92. 4
      src/test/subscription/t/006_rewrite.pl
  93. 4
      src/test/subscription/t/007_ddl.pl
  94. 4
      src/test/subscription/t/008_diff_schema.pl
  95. 4
      src/test/subscription/t/009_matviews.pl
  96. 4
      src/test/subscription/t/010_truncate.pl
  97. 4
      src/test/subscription/t/011_generated.pl
  98. 4
      src/test/subscription/t/012_collation.pl
  99. 6
      src/test/subscription/t/013_partition.pl
  100. 4
      src/test/subscription/t/014_binary.pl
  101. Some files were not shown because too many files have changed in this diff Show More

@ -15,7 +15,7 @@ my ($node, $result);
#
# Test set-up
#
$node = get_new_node('test');
$node = PostgresNode->new('test');
$node->init;
$node->append_conf('postgresql.conf', 'autovacuum=off');
$node->start;

@ -8,7 +8,7 @@ use PostgresNode;
use TestLib;
use Test::More tests => 4;
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->append_conf('postgresql.conf',
"shared_preload_libraries = 'auto_explain'");

@ -43,7 +43,7 @@ SELECT * FROM tst WHERE i = 7 AND t = 'e';
}
# Initialize primary node
$node_primary = get_new_node('primary');
$node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1);
$node_primary->start;
my $backup_name = 'my_backup';
@ -52,7 +52,7 @@ my $backup_name = 'my_backup';
$node_primary->backup($backup_name);
# Create streaming standby linking to primary
$node_standby = get_new_node('standby');
$node_standby = PostgresNode->new('standby');
$node_standby->init_from_backup($node_primary, $backup_name,
has_streaming => 1);
$node_standby->start;

@ -11,7 +11,7 @@ use TestLib;
use Test::More tests => 2;
# Test set-up
my $node = get_new_node('test');
my $node = PostgresNode->new('test');
$node->init(allows_streaming => 'logical');
$node->append_conf('postgresql.conf', 'synchronous_commit = on');
$node->start;

@ -10,7 +10,7 @@ use Test::More tests => 72;
# Test set-up
my ($node, $port);
$node = get_new_node('test');
$node = PostgresNode->new('test');
$node->init;
$node->start;
$port = $node->port;

@ -120,7 +120,7 @@ sub perform_all_corruptions()
}
# Test set-up
$node = get_new_node('test');
$node = PostgresNode->new('test');
$node->init;
$node->append_conf('postgresql.conf', 'autovacuum=off');
$node->start;

@ -178,7 +178,7 @@ umask(0077);
# Set up the node. Once we create and corrupt the table,
# autovacuum workers visiting the table could crash the backend.
# Disable autovacuum so that won't happen.
my $node = get_new_node('test');
my $node = PostgresNode->new('test');
$node->init;
$node->append_conf('postgresql.conf', 'autovacuum=off');

@ -10,7 +10,7 @@ use PostgresNode;
use TestLib;
use Test::More tests => 5;
my $node = get_new_node('test');
my $node = PostgresNode->new('test');
$node->init;
$node->start;

@ -18,7 +18,7 @@ program_options_handling_ok('pg_basebackup');
my $tempdir = TestLib::tempdir;
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
# Set umask so test directories and files are created with default permissions
umask(0077);
@ -268,7 +268,7 @@ SKIP:
skip "no tar program available", 1
if (!defined $tar || $tar eq '');
my $node2 = get_new_node('replica');
my $node2 = PostgresNode->new('replica');
# Recover main data directory
$node2->init_from_backup($node, 'tarbackup2', tar_program => $tar);

@ -14,7 +14,7 @@ program_options_handling_ok('pg_receivewal');
# Set umask so test directories and files are created with default permissions
umask(0077);
my $primary = get_new_node('primary');
my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1);
$primary->start;

@ -11,7 +11,7 @@ program_help_ok('pg_recvlogical');
program_version_ok('pg_recvlogical');
program_options_handling_ok('pg_recvlogical');
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
# Initialize node without replication settings
$node->init(allows_streaming => 1, has_archiving => 1);

@ -92,7 +92,7 @@ sub check_relation_corruption
}
# Initialize node with checksums disabled.
my $node = get_new_node('node_checksum');
my $node = PostgresNode->new('node_checksum');
$node->init();
my $pgdata = $node->data_dir;

@ -14,7 +14,7 @@ command_fails(['pg_controldata'], 'pg_controldata without arguments fails');
command_fails([ 'pg_controldata', 'nonexistent' ],
'pg_controldata with nonexistent directory fails');
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
command_like([ 'pg_controldata', $node->data_dir ],

@ -14,7 +14,7 @@ my $tempdir_short = TestLib::tempdir_short;
command_exit_is([ 'pg_ctl', 'status', '-D', "$tempdir/nonexistent" ],
4, 'pg_ctl status with nonexistent directory');
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
command_exit_is([ 'pg_ctl', 'status', '-D', $node->data_dir ],

@ -15,7 +15,7 @@ command_fails_like(
qr/directory .* does not exist/,
'pg_ctl promote with nonexistent directory');
my $node_primary = get_new_node('primary');
my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1);
command_fails_like(
@ -30,7 +30,7 @@ command_fails_like(
qr/not in standby mode/,
'pg_ctl promote of primary instance fails');
my $node_standby = get_new_node('standby');
my $node_standby = PostgresNode->new('standby');
$node_primary->backup('my_backup');
$node_standby->init_from_backup($node_primary, 'my_backup',
has_streaming => 1);
@ -47,7 +47,7 @@ ok( $node_standby->poll_query_until(
'promoted standby is not in recovery');
# same again with default wait option
$node_standby = get_new_node('standby2');
$node_standby = PostgresNode->new('standby2');
$node_standby->init_from_backup($node_primary, 'my_backup',
has_streaming => 1);
$node_standby->start;

@ -10,7 +10,7 @@ use Test::More tests => 5;
use Time::HiRes qw(usleep);
# Set up node with logging collector
my $node = get_new_node('primary');
my $node = PostgresNode->new('primary');
$node->init();
$node->append_conf(
'postgresql.conf', qq(

@ -3562,7 +3562,7 @@ my %tests = (
#########################################
# Create a PG instance to test actually dumping from
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -11,7 +11,7 @@ use Test::More tests => 3;
my $tempdir = TestLib::tempdir;
my $tempdir_short = TestLib::tempdir_short;
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
my $port = $node->port;
$node->init;

@ -51,7 +51,7 @@ my $dbname4 = 'regression' . generate_ascii_string(203, 255);
my $src_bootstrap_super = 'regress_postgres';
my $dst_bootstrap_super = 'boot';
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init(extra =>
[ '-U', $src_bootstrap_super, '--locale=C', '--encoding=LATIN1' ]);
@ -181,7 +181,7 @@ $restore_super =~ s/"//g
# Restore full dump through psql using environment variables for
# dbname/user connection parameters
my $envar_node = get_new_node('destination_envar');
my $envar_node = PostgresNode->new('destination_envar');
$envar_node->init(
extra =>
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ],
@ -208,7 +208,7 @@ is($stderr, '', 'no dump errors');
# dbname/user connection parameters. "\connect dbname=" forgets
# user/port from command line.
my $cmdline_node = get_new_node('destination_cmdline');
my $cmdline_node = PostgresNode->new('destination_cmdline');
$cmdline_node->init(
extra =>
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ],

@ -12,7 +12,7 @@ program_help_ok('pg_resetwal');
program_version_ok('pg_resetwal');
program_options_handling_ok('pg_resetwal');
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
command_like([ 'pg_resetwal', '-n', $node->data_dir ],

@ -10,7 +10,7 @@ use PostgresNode;
use TestLib;
use Test::More tests => 6;
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
my $pg_control = $node->data_dir . '/global/pg_control';

@ -58,13 +58,13 @@ primary_psql("CHECKPOINT");
#
# A (primary) <--- B (standby) <--- C (standby)
$node_a->backup('my_backup');
$node_b = get_new_node('node_b');
$node_b = PostgresNode->new('node_b');
$node_b->init_from_backup($node_a, 'my_backup', has_streaming => 1);
$node_b->set_standby_mode();
$node_b->start;
$node_b->backup('my_backup');
$node_c = get_new_node('node_c');
$node_c = PostgresNode->new('node_c');
$node_c->init_from_backup($node_b, 'my_backup', has_streaming => 1);
$node_c->set_standby_mode();
$node_c->start;

@ -40,7 +40,7 @@ use File::Copy;
my $tmp_folder = TestLib::tempdir;
my $node_1 = get_new_node('node_1');
my $node_1 = PostgresNode->new('node_1');
$node_1->init(allows_streaming => 1);
$node_1->append_conf(
'postgresql.conf', qq(
@ -60,11 +60,11 @@ $node_1->safe_psql('postgres', "INSERT INTO public.bar VALUES ('in both')");
my $backup_name = 'my_backup';
$node_1->backup($backup_name);
my $node_2 = get_new_node('node_2');
my $node_2 = PostgresNode->new('node_2');
$node_2->init_from_backup($node_1, $backup_name, has_streaming => 1);
$node_2->start;
my $node_3 = get_new_node('node_3');
my $node_3 = PostgresNode->new('node_3');
$node_3->init_from_backup($node_1, $backup_name, has_streaming => 1);
$node_3->start;

@ -128,7 +128,7 @@ sub setup_cluster
# Initialize primary, data checksums are mandatory
$node_primary =
get_new_node('primary' . ($extra_name ? "_${extra_name}" : ''));
PostgresNode->new('primary' . ($extra_name ? "_${extra_name}" : ''));
# Set up pg_hba.conf and pg_ident.conf for the role running
# pg_rewind. This role is used for all the tests, and has
@ -176,7 +176,7 @@ sub create_standby
my $extra_name = shift;
$node_standby =
get_new_node('standby' . ($extra_name ? "_${extra_name}" : ''));
PostgresNode->new('standby' . ($extra_name ? "_${extra_name}" : ''));
$node_primary->backup('my_backup');
$node_standby->init_from_backup($node_primary, 'my_backup');
my $connstr_primary = $node_primary->connstr();

@ -12,7 +12,7 @@ use PostgresNode;
use TestLib;
use Test::More tests => 19;
my $primary = get_new_node('primary');
my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1);
$primary->start;

@ -12,7 +12,7 @@ use PostgresNode;
use TestLib;
use Test::More tests => 44;
my $primary = get_new_node('primary');
my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1);
$primary->start;

@ -13,7 +13,7 @@ use TestLib;
use Test::More tests => 25;
# Start up the server and take a backup.
my $primary = get_new_node('primary');
my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1);
$primary->start;
my $backup_path = $primary->backup_dir . '/test_options';

@ -11,7 +11,7 @@ use PostgresNode;
use TestLib;
use Test::More tests => 5;
my $primary = get_new_node('primary');
my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1);
$primary->start;
my $backup_path = $primary->backup_dir . '/test_encoding';

@ -13,7 +13,7 @@ use TestLib;
use Test::More tests => 7;
# Start up the server and take a backup.
my $primary = get_new_node('primary');
my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1);
$primary->start;
my $backup_path = $primary->backup_dir . '/test_wal';

@ -10,7 +10,7 @@ use Test::More;
use Config;
# start a pgbench specific server
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -34,7 +34,7 @@ if ($@)
}
# start a new server
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -12,7 +12,7 @@ program_help_ok('clusterdb');
program_version_ok('clusterdb');
program_options_handling_ok('clusterdb');
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -8,7 +8,7 @@ use PostgresNode;
use TestLib;
use Test::More tests => 2;
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -12,7 +12,7 @@ program_help_ok('createdb');
program_version_ok('createdb');
program_options_handling_ok('createdb');
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -12,7 +12,7 @@ program_help_ok('createuser');
program_version_ok('createuser');
program_options_handling_ok('createuser');
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -12,7 +12,7 @@ program_help_ok('dropdb');
program_version_ok('dropdb');
program_options_handling_ok('dropdb');
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -12,7 +12,7 @@ program_help_ok('dropuser');
program_version_ok('dropuser');
program_options_handling_ok('dropuser');
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -14,7 +14,7 @@ program_options_handling_ok('pg_isready');
command_fails(['pg_isready'], 'fails with no server running');
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -12,7 +12,7 @@ program_help_ok('reindexdb');
program_version_ok('reindexdb');
program_options_handling_ok('reindexdb');
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -7,7 +7,7 @@ use warnings;
use PostgresNode;
use Test::More tests => 2;
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -12,7 +12,7 @@ program_help_ok('vacuumdb');
program_version_ok('vacuumdb');
program_options_handling_ok('vacuumdb');
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -7,7 +7,7 @@ use warnings;
use PostgresNode;
use Test::More tests => 2;
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -7,7 +7,7 @@ use warnings;
use PostgresNode;
use Test::More tests => 4;
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -23,7 +23,7 @@ my $dbname2 =
my $dbname3 = generate_ascii_string(130, 192);
my $dbname4 = generate_ascii_string(193, 255);
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init(extra => [ '--locale=C', '--encoding=LATIN1' ]);
$node->start;

@ -62,7 +62,7 @@ sub test_role
}
# Initialize primary node
my $node = get_new_node('primary');
my $node = PostgresNode->new('primary');
$node->init;
$node->append_conf('postgresql.conf', "log_connections = on\n");
$node->start;

@ -62,7 +62,7 @@ sub test_login
# Initialize primary node. Force UTF-8 encoding, so that we can use non-ASCII
# characters in the passwords below.
my $node = get_new_node('primary');
my $node = PostgresNode->new('primary');
$node->init(extra => [ '--locale=C', '--encoding=UTF8' ]);
$node->start;

@ -167,7 +167,7 @@ END
note "setting up PostgreSQL instance";
my $node = get_new_node('node');
my $node = PostgresNode->new('node');
$node->init;
$node->append_conf(
'postgresql.conf', qq{

@ -153,7 +153,7 @@ system_or_bail 'ldappasswd', '-x', '-y', $ldap_pwfile, '-s', 'secret2',
note "setting up PostgreSQL instance";
my $node = get_new_node('node');
my $node = PostgresNode->new('node');
$node->init;
$node->append_conf('postgresql.conf', "log_connections = on\n");
$node->start;

@ -10,7 +10,7 @@ use TestLib;
use Test::More tests => 2;
use PostgresNode;
my $node = get_new_node('tango');
my $node = PostgresNode->new('tango');
$node->init;
$node->append_conf('postgresql.conf', 'autovacuum_naptime=1s');
$node->start;

@ -10,7 +10,7 @@ use TestLib;
use Test::More tests => 2;
use PostgresNode;
my $node = get_new_node('foxtrot');
my $node = PostgresNode->new('foxtrot');
$node->init;
$node->append_conf('postgresql.conf', 'track_commit_timestamp = on');
$node->start;

@ -11,7 +11,7 @@ use Test::More tests => 4;
use PostgresNode;
my $bkplabel = 'backup';
my $primary = get_new_node('primary');
my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1);
$primary->append_conf(
@ -22,7 +22,7 @@ $primary->append_conf(
$primary->start;
$primary->backup($bkplabel);
my $standby = get_new_node('standby');
my $standby = PostgresNode->new('standby');
$standby->init_from_backup($primary, $bkplabel, has_streaming => 1);
$standby->start;

@ -11,7 +11,7 @@ use Test::More tests => 4;
use PostgresNode;
my $bkplabel = 'backup';
my $primary = get_new_node('primary');
my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1);
$primary->append_conf(
'postgresql.conf', qq{
@ -21,7 +21,7 @@ $primary->append_conf(
$primary->start;
$primary->backup($bkplabel);
my $standby = get_new_node('standby');
my $standby = PostgresNode->new('standby');
$standby->init_from_backup($primary, $bkplabel, has_streaming => 1);
$standby->start;

@ -8,7 +8,7 @@ use PostgresNode;
use TestLib;
use Test::More tests => 16;
my $node_primary = get_new_node('primary');
my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1);
$node_primary->append_conf('postgresql.conf', 'track_commit_timestamp = on');
$node_primary->start;

@ -9,7 +9,7 @@ use PostgresNode;
use TestLib;
use Test::More;
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -20,7 +20,7 @@ my $rot13pass = "SbbOnE1";
# see the Makefile for how the certificate and key have been generated
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->append_conf('postgresql.conf',
"ssl_passphrase.passphrase = '$rot13pass'");

@ -10,7 +10,7 @@ use TestLib;
use Test::More tests => 42;
# Initialize a test cluster
my $node = get_new_node('primary');
my $node = PostgresNode->new('primary');
$node->init();
# Turn message level up to DEBUG1 so that we get the messages we want to see
$node->append_conf('postgresql.conf', 'client_min_messages = DEBUG1');

@ -713,7 +713,7 @@ my %tests = (
#########################################
# Create a PG instance to test actually dumping from
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -11,7 +11,7 @@ PostgresNode - class representing PostgreSQL server instance
use PostgresNode;
my $node = PostgresNode->get_new_node('mynode');
my $node = PostgresNode->new('mynode');
# Create a data directory with initdb
$node->init();
@ -61,9 +61,9 @@ PostgresNode - class representing PostgreSQL server instance
my $ret = $node->backup_fs_cold('testbackup3')
# Restore it to create a new independent node (not a replica)
my $replica = get_new_node('replica');
$replica->init_from_backup($node, 'testbackup');
$replica->start;
my $other_node = PostgresNode->new('mycopy');
$other_node->init_from_backup($node, 'testbackup');
$other_node->start;
# Stop the server
$node->stop('fast');
@ -110,7 +110,6 @@ use Time::HiRes qw(usleep);
use Scalar::Util qw(blessed);
our @EXPORT = qw(
get_new_node
get_free_port
);
@ -139,41 +138,6 @@ INIT
=over
=item PostgresNode::new($class, $name, $pghost, $pgport)
Create a new PostgresNode instance. Does not initdb or start it.
You should generally prefer to use get_new_node() instead since it takes care
of finding port numbers, registering instances for cleanup, etc.
=cut
sub new
{
my ($class, $name, $pghost, $pgport) = @_;
my $testname = basename($0);
$testname =~ s/\.[^.]+$//;
my $self = {
_port => $pgport,
_host => $pghost,
_basedir => "$TestLib::tmp_check/t_${testname}_${name}_data",
_name => $name,
_logfile_generation => 0,
_logfile_base => "$TestLib::log_path/${testname}_${name}",
_logfile => "$TestLib::log_path/${testname}_${name}.log"
};
bless $self, $class;
mkdir $self->{_basedir}
or
BAIL_OUT("could not create data directory \"$self->{_basedir}\": $!");
$self->dump_info;
return $self;
}
=pod
=item $node->port()
Get the port number assigned to the host. This won't necessarily be a TCP port
@ -1168,15 +1132,13 @@ sub _update_pid
=pod
=item PostgresNode->get_new_node(node_name, %params)
=item PostgresNode->new(node_name, %params)
Build a new object of class C<PostgresNode> (or of a subclass, if you have
one), assigning a free port number. Remembers the node, to prevent its port
number from being reused for another node, and to ensure that it gets
shut down when the test script exits.
You should generally use this instead of C<PostgresNode::new(...)>.
=over
=item port => [1,65535]
@ -1201,15 +1163,11 @@ not provided, Postgres binaries will be found in the caller's PATH.
=back
For backwards compatibility, it is also exported as a standalone function,
which can only create objects of class C<PostgresNode>.
=cut
sub get_new_node
sub new
{
my $class = 'PostgresNode';
$class = shift if scalar(@_) % 2 != 1;
my $class = shift;
my ($name, %params) = @_;
# Select a port.
@ -1244,14 +1202,30 @@ sub get_new_node
}
}
# Lock port number found by creating a new node
my $node = $class->new($name, $host, $port);
my $testname = basename($0);
$testname =~ s/\.[^.]+$//;
my $node = {
_port => $port,
_host => $host,
_basedir => "$TestLib::tmp_check/t_${testname}_${name}_data",
_name => $name,
_logfile_generation => 0,
_logfile_base => "$TestLib::log_path/${testname}_${name}",
_logfile => "$TestLib::log_path/${testname}_${name}.log"
};
if ($params{install_path})
{
$node->{_install_path} = $params{install_path};
}
bless $node, $class;
mkdir $node->{_basedir}
or
BAIL_OUT("could not create data directory \"$node->{_basedir}\": $!");
$node->dump_info;
# Add node to list of nodes
push(@all_nodes, $node);
@ -1322,7 +1296,7 @@ sub _set_pg_version
# the remainder are# set. Then the PATH and (DY)LD_LIBRARY_PATH are adjusted
# if the node's install path is set, and the copy environment is returned.
#
# The install path set in get_new_node needs to be a directory containing
# The install path set in new() needs to be a directory containing
# bin and lib subdirectories as in a standard PostgreSQL installation, so this
# can't be used with installations where the bin and lib directories don't have
# a common parent directory.
@ -1407,7 +1381,7 @@ sub installed_command
=item get_free_port()
Locate an unprivileged (high) TCP port that's not currently bound to
anything. This is used by get_new_node, and is also exported for use
anything. This is used by new(), and is also exported for use
by test cases that need to start other, non-Postgres servers.
Ports assigned to existing PostgresNode objects are automatically

@ -48,7 +48,7 @@ Each test script should begin with:
then it will generally need to set up one or more nodes, run commands
against them and evaluate the results. For example:
my $node = PostgresNode->get_new_node('primary');
my $node = PostgresNode->new('primary');
$node->init;
$node->start;

@ -9,7 +9,7 @@ use TestLib;
use Test::More tests => 49;
# Initialize primary node
my $node_primary = get_new_node('primary');
my $node_primary = PostgresNode->new('primary');
# A specific role is created to perform some tests related to replication,
# and it needs proper authentication configuration.
$node_primary->init(
@ -22,7 +22,7 @@ my $backup_name = 'my_backup';
$node_primary->backup($backup_name);
# Create streaming standby linking to primary
my $node_standby_1 = get_new_node('standby_1');
my $node_standby_1 = PostgresNode->new('standby_1');
$node_standby_1->init_from_backup($node_primary, $backup_name,
has_streaming => 1);
$node_standby_1->start;
@ -37,7 +37,7 @@ $node_standby_1->backup('my_backup_2');
$node_primary->start;
# Create second standby node linking to standby 1
my $node_standby_2 = get_new_node('standby_2');
my $node_standby_2 = PostgresNode->new('standby_2');
$node_standby_2->init_from_backup($node_standby_1, $backup_name,
has_streaming => 1);
$node_standby_2->start;

@ -10,7 +10,7 @@ use Test::More tests => 3;
use File::Copy;
# Initialize primary node, doing archives
my $node_primary = get_new_node('primary');
my $node_primary = PostgresNode->new('primary');
$node_primary->init(
has_archiving => 1,
allows_streaming => 1);
@ -23,7 +23,7 @@ $node_primary->start;
$node_primary->backup($backup_name);
# Initialize standby node from backup, fetching WAL from archives
my $node_standby = get_new_node('standby');
my $node_standby = PostgresNode->new('standby');
$node_standby->init_from_backup($node_primary, $backup_name,
has_restoring => 1);
$node_standby->append_conf('postgresql.conf',
@ -62,7 +62,7 @@ is($result, qq(1000), 'check content from archives');
# promoted.
$node_standby->promote;
my $node_standby2 = get_new_node('standby2');
my $node_standby2 = PostgresNode->new('standby2');
$node_standby2->init_from_backup($node_primary, $backup_name,
has_restoring => 1);
$node_standby2->start;

@ -21,7 +21,7 @@ sub test_recovery_standby
my $num_rows = shift;
my $until_lsn = shift;
my $node_standby = get_new_node($node_name);
my $node_standby = PostgresNode->new($node_name);
$node_standby->init_from_backup($node_primary, 'my_backup',
has_restoring => 1);
@ -50,7 +50,7 @@ sub test_recovery_standby
}
# Initialize primary node
my $node_primary = get_new_node('primary');
my $node_primary = PostgresNode->new('primary');
$node_primary->init(has_archiving => 1, allows_streaming => 1);
# Bump the transaction ID epoch. This is useful to stress the portability
@ -136,7 +136,7 @@ test_recovery_standby('LSN', 'standby_5', $node_primary, \@recovery_params,
test_recovery_standby('multiple overriding settings',
'standby_6', $node_primary, \@recovery_params, "3000", $lsn3);
my $node_standby = get_new_node('standby_7');
my $node_standby = PostgresNode->new('standby_7');
$node_standby->init_from_backup($node_primary, 'my_backup',
has_restoring => 1);
$node_standby->append_conf(
@ -156,7 +156,7 @@ ok($logfile =~ qr/multiple recovery targets specified/,
# Check behavior when recovery ends before target is reached
$node_standby = get_new_node('standby_8');
$node_standby = PostgresNode->new('standby_8');
$node_standby->init_from_backup(
$node_primary, 'my_backup',
has_restoring => 1,

@ -15,7 +15,7 @@ $ENV{PGDATABASE} = 'postgres';
# on a new timeline.
# Initialize primary node
my $node_primary = get_new_node('primary');
my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1);
$node_primary->start;
@ -24,11 +24,11 @@ my $backup_name = 'my_backup';
$node_primary->backup($backup_name);
# Create two standbys linking to it
my $node_standby_1 = get_new_node('standby_1');
my $node_standby_1 = PostgresNode->new('standby_1');
$node_standby_1->init_from_backup($node_primary, $backup_name,
has_streaming => 1);
$node_standby_1->start;
my $node_standby_2 = get_new_node('standby_2');
my $node_standby_2 = PostgresNode->new('standby_2');
$node_standby_2->init_from_backup($node_primary, $backup_name,
has_streaming => 1);
$node_standby_2->start;
@ -76,7 +76,7 @@ is($result, qq(2000), 'check content of standby 2');
# when WAL archiving is enabled.
# Initialize primary node
my $node_primary_2 = get_new_node('primary_2');
my $node_primary_2 = PostgresNode->new('primary_2');
$node_primary_2->init(allows_streaming => 1, has_archiving => 1);
$node_primary_2->append_conf(
'postgresql.conf', qq(
@ -88,7 +88,7 @@ $node_primary_2->start;
$node_primary_2->backup($backup_name);
# Create standby node
my $node_standby_3 = get_new_node('standby_3');
my $node_standby_3 = PostgresNode->new('standby_3');
$node_standby_3->init_from_backup($node_primary_2, $backup_name,
has_streaming => 1);

@ -10,7 +10,7 @@ use TestLib;
use Test::More tests => 3;
# Initialize primary node
my $node_primary = get_new_node('primary');
my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1);
$node_primary->start;
@ -23,7 +23,7 @@ my $backup_name = 'my_backup';
$node_primary->backup($backup_name);
# Create streaming standby from backup
my $node_standby = get_new_node('standby');
my $node_standby = PostgresNode->new('standby');
my $delay = 3;
$node_standby->init_from_backup($node_primary, $backup_name,
has_streaming => 1);
@ -58,7 +58,7 @@ ok(time() - $primary_insert_time >= $delay,
# Check that recovery can be paused or resumed expectedly.
my $node_standby2 = get_new_node('standby2');
my $node_standby2 = PostgresNode->new('standby2');
$node_standby2->init_from_backup($node_primary, $backup_name,
has_streaming => 1);
$node_standby2->start;

@ -14,7 +14,7 @@ use Test::More tests => 14;
use Config;
# Initialize primary node
my $node_primary = get_new_node('primary');
my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1);
$node_primary->append_conf(
'postgresql.conf', qq(

@ -49,7 +49,7 @@ sub start_standby_and_wait
}
# Initialize primary node
my $node_primary = get_new_node('primary');
my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1);
$node_primary->start;
my $backup_name = 'primary_backup';
@ -61,19 +61,19 @@ $node_primary->backup($backup_name);
# the ordering of each one of them in the WAL sender array of the primary.
# Create standby1 linking to primary
my $node_standby_1 = get_new_node('standby1');
my $node_standby_1 = PostgresNode->new('standby1');
$node_standby_1->init_from_backup($node_primary, $backup_name,
has_streaming => 1);
start_standby_and_wait($node_primary, $node_standby_1);
# Create standby2 linking to primary
my $node_standby_2 = get_new_node('standby2');
my $node_standby_2 = PostgresNode->new('standby2');
$node_standby_2->init_from_backup($node_primary, $backup_name,
has_streaming => 1);
start_standby_and_wait($node_primary, $node_standby_2);
# Create standby3 linking to primary
my $node_standby_3 = get_new_node('standby3');
my $node_standby_3 = PostgresNode->new('standby3');
$node_standby_3->init_from_backup($node_primary, $backup_name,
has_streaming => 1);
start_standby_and_wait($node_primary, $node_standby_3);
@ -123,7 +123,7 @@ standby3|3|sync),
start_standby_and_wait($node_primary, $node_standby_1);
# Create standby4 linking to primary
my $node_standby_4 = get_new_node('standby4');
my $node_standby_4 = PostgresNode->new('standby4');
$node_standby_4->init_from_backup($node_primary, $backup_name,
has_streaming => 1);
$node_standby_4->start;

@ -12,7 +12,7 @@ use PostgresNode;
use TestLib;
use Test::More tests => 1;
my $node_primary = get_new_node('primary');
my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1);
$node_primary->append_conf(
@ -28,7 +28,7 @@ autovacuum = off
$node_primary->start;
$node_primary->backup('primary_backup');
my $node_standby = get_new_node('standby');
my $node_standby = PostgresNode->new('standby');
$node_standby->init_from_backup($node_primary, 'primary_backup',
has_streaming => 1);
$node_standby->start;

@ -29,7 +29,7 @@ sub configure_and_reload
# Set up two nodes, which will alternately be primary and replication standby.
# Setup london node
my $node_london = get_new_node("london");
my $node_london = PostgresNode->new("london");
$node_london->init(allows_streaming => 1);
$node_london->append_conf(
'postgresql.conf', qq(
@ -40,7 +40,7 @@ $node_london->start;
$node_london->backup('london_backup');
# Setup paris node
my $node_paris = get_new_node('paris');
my $node_paris = PostgresNode->new('paris');
$node_paris->init_from_backup($node_london, 'london_backup',
has_streaming => 1);
$node_paris->start;

@ -34,7 +34,7 @@ use Scalar::Util qw(blessed);
my ($stdout, $stderr, $ret);
# Initialize primary node
my $node_primary = get_new_node('primary');
my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1, has_archiving => 1);
$node_primary->append_conf(
'postgresql.conf', q[
@ -74,7 +74,7 @@ $node_primary->backup_fs_hot($backup_name);
$node_primary->safe_psql('postgres',
q[SELECT pg_create_physical_replication_slot('phys_slot');]);
my $node_replica = get_new_node('replica');
my $node_replica = PostgresNode->new('replica');
$node_replica->init_from_backup(
$node_primary, $backup_name,
has_streaming => 1,

@ -13,7 +13,7 @@ use Config;
plan tests => 3;
my $node = get_new_node('primary');
my $node = PostgresNode->new('primary');
$node->init(allows_streaming => 1);
$node->start;

@ -10,7 +10,7 @@ use TestLib;
use Test::More tests => 12;
# Setup primary node
my $node_primary = get_new_node("primary");
my $node_primary = PostgresNode->new("primary");
$node_primary->init(allows_streaming => 1);
$node_primary->append_conf(
'postgresql.conf', qq(
@ -22,7 +22,7 @@ $node_primary->backup('primary_backup');
$node_primary->psql('postgres', "CREATE TABLE t_012_tbl (id int)");
# Setup standby node
my $node_standby = get_new_node('standby');
my $node_standby = PostgresNode->new('standby');
$node_standby->init_from_backup($node_primary, 'primary_backup',
has_streaming => 1);
$node_standby->start;

@ -27,7 +27,7 @@ plan tests => 18;
# is really wrong.
my $psql_timeout = IPC::Run::timer(60);
my $node = get_new_node('primary');
my $node = PostgresNode->new('primary');
$node->init(allows_streaming => 1);
$node->start();

@ -12,7 +12,7 @@ use PostgresNode;
use TestLib;
use Test::More tests => 12;
my $node = get_new_node('main');
my $node = PostgresNode->new('main');
$node->init;
$node->start;

@ -12,7 +12,7 @@ use TestLib;
use Test::More tests => 1;
# Initialize primary node
my $alpha = get_new_node('alpha');
my $alpha = PostgresNode->new('alpha');
$alpha->init(allows_streaming => 1);
# Setting wal_log_hints to off is important to get invalid page
# references.
@ -25,7 +25,7 @@ $alpha->start;
# setup/start a standby
$alpha->backup('bkp');
my $bravo = get_new_node('bravo');
my $bravo = PostgresNode->new('bravo');
$bravo->init_from_backup($alpha, 'bkp', has_streaming => 1);
$bravo->append_conf('postgresql.conf', <<EOF);
checkpoint_timeout=1h

@ -43,7 +43,7 @@ sub find_largest_lsn
}
# Initialize primary node
my $primary = get_new_node('primary');
my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1);
# Set shared_buffers to a very low value to enforce discard and flush
@ -61,7 +61,7 @@ $primary->start;
# setup/start a standby
$primary->backup('bkp');
my $standby = get_new_node('standby');
my $standby = PostgresNode->new('standby');
$standby->init_from_backup($primary, 'bkp', has_streaming => 1);
$standby->start;

@ -43,7 +43,7 @@ sub log_ipcs
}
# Node setup.
my $gnat = PostgresNode->get_new_node('gnat');
my $gnat = PostgresNode->new('gnat');
$gnat->init;
# Create a shmem segment that will conflict with gnat's first choice

@ -43,7 +43,7 @@ sub run_wal_optimize
{
my $wal_level = shift;
my $node = get_new_node("node_$wal_level");
my $node = PostgresNode->new("node_$wal_level");
$node->init;
$node->append_conf(
'postgresql.conf', qq(

@ -17,7 +17,7 @@ use Time::HiRes qw(usleep);
$ENV{PGDATABASE} = 'postgres';
# Initialize primary node, setting wal-segsize to 1MB
my $node_primary = get_new_node('primary');
my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1, extra => ['--wal-segsize=1']);
$node_primary->append_conf(
'postgresql.conf', qq(
@ -41,7 +41,7 @@ my $backup_name = 'my_backup';
$node_primary->backup($backup_name);
# Create a standby linking to it using the replication slot
my $node_standby = get_new_node('standby_1');
my $node_standby = PostgresNode->new('standby_1');
$node_standby->init_from_backup($node_primary, $backup_name,
has_streaming => 1);
$node_standby->append_conf('postgresql.conf', "primary_slot_name = 'rep1'");
@ -250,7 +250,7 @@ ok($failed, 'check that replication has been broken');
$node_primary->stop;
$node_standby->stop;
my $node_primary2 = get_new_node('primary2');
my $node_primary2 = PostgresNode->new('primary2');
$node_primary2->init(allows_streaming => 1);
$node_primary2->append_conf(
'postgresql.conf', qq(
@ -271,7 +271,7 @@ max_slot_wal_keep_size = 0
));
$node_primary2->start;
$node_standby = get_new_node('standby_2');
$node_standby = PostgresNode->new('standby_2');
$node_standby->init_from_backup($node_primary2, $backup_name,
has_streaming => 1);
$node_standby->append_conf('postgresql.conf', "primary_slot_name = 'rep1'");
@ -303,7 +303,7 @@ if ($TestLib::windows_os)
# Get a slot terminated while the walsender is active
# We do this by sending SIGSTOP to the walsender. Skip this on Windows.
my $node_primary3 = get_new_node('primary3');
my $node_primary3 = PostgresNode->new('primary3');
$node_primary3->init(allows_streaming => 1, extra => ['--wal-segsize=1']);
$node_primary3->append_conf(
'postgresql.conf', qq(
@ -319,7 +319,7 @@ $node_primary3->safe_psql('postgres',
$backup_name = 'my_backup';
$node_primary3->backup($backup_name);
# Create standby
my $node_standby3 = get_new_node('standby_3');
my $node_standby3 = PostgresNode->new('standby_3');
$node_standby3->init_from_backup($node_primary3, $backup_name,
has_streaming => 1);
$node_standby3->append_conf('postgresql.conf', "primary_slot_name = 'rep3'");

@ -11,7 +11,7 @@ use TestLib;
use Test::More tests => 16;
use Config;
my $primary = get_new_node('primary');
my $primary = PostgresNode->new('primary');
$primary->init(
has_archiving => 1,
allows_streaming => 1);
@ -138,7 +138,7 @@ $primary->poll_query_until('postgres',
or die "Timed out while waiting for archiving to finish";
# Test standby with archive_mode = on.
my $standby1 = get_new_node('standby');
my $standby1 = PostgresNode->new('standby');
$standby1->init_from_backup($primary, 'backup', has_restoring => 1);
$standby1->append_conf('postgresql.conf', "archive_mode = on");
my $standby1_data = $standby1->data_dir;
@ -174,7 +174,7 @@ ok( -f "$standby1_data/$segment_path_2_done",
# command to fail to persist the .ready files. Note that this node
# has inherited the archive command of the previous cold backup that
# will cause archiving failures.
my $standby2 = get_new_node('standby2');
my $standby2 = PostgresNode->new('standby2');
$standby2->init_from_backup($primary, 'backup', has_restoring => 1);
$standby2->append_conf('postgresql.conf', 'archive_mode = always');
my $standby2_data = $standby2->data_dir;

@ -12,7 +12,7 @@ use Test::More tests => 10;
use Config;
# Initialize primary node
my $node_primary = get_new_node('primary');
my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1);
$node_primary->append_conf('postgresql.conf', 'max_prepared_transactions=10');
$node_primary->start;
@ -26,7 +26,7 @@ my $backup_name = 'my_backup';
$node_primary->backup($backup_name);
# Create streaming standby from backup
my $node_standby = get_new_node('standby');
my $node_standby = PostgresNode->new('standby');
$node_standby->init_from_backup($node_primary, $backup_name,
has_streaming => 1);
$node_standby->append_conf('postgresql.conf', 'max_prepared_transactions=10');

@ -26,7 +26,7 @@ else
# is really wrong.
my $psql_timeout = IPC::Run::timer(60);
my $node = get_new_node('node_crash');
my $node = PostgresNode->new('node_crash');
$node->init();
$node->start();

@ -10,7 +10,7 @@ use Test::More tests => 1;
use File::Compare;
# Initialize and start primary node with WAL archiving
my $node_primary = get_new_node('primary');
my $node_primary = PostgresNode->new('primary');
$node_primary->init(has_archiving => 1, allows_streaming => 1);
$node_primary->append_conf(
'postgresql.conf', qq{
@ -24,7 +24,7 @@ $node_primary->backup($backup_name);
# Initialize node for PITR targeting a very specific restore point, just
# after a PREPARE TRANSACTION is issued so as we finish with a promoted
# node where this 2PC transaction needs an explicit COMMIT PREPARED.
my $node_pitr = get_new_node('node_pitr');
my $node_pitr = PostgresNode->new('node_pitr');
$node_pitr->init_from_backup(
$node_primary, $backup_name,
standby => 0,

@ -11,7 +11,7 @@ use Time::HiRes qw(usleep);
# Initialize and start node with wal_level = replica and WAL archiving
# enabled.
my $node = get_new_node('orig');
my $node = PostgresNode->new('orig');
$node->init(has_archiving => 1, allows_streaming => 1);
my $replica_config = q[
wal_level = replica
@ -66,7 +66,7 @@ sub test_recovery_wal_level_minimal
{
my ($node_name, $node_text, $standby_setting) = @_;
my $recovery_node = get_new_node($node_name);
my $recovery_node = PostgresNode->new($node_name);
$recovery_node->init_from_backup(
$node, $backup_name,
has_restoring => 1,

@ -16,7 +16,7 @@ use FindBin;
use Test::More tests => 1;
# Initialize primary node
my $node_primary = get_new_node('primary');
my $node_primary = PostgresNode->new('primary');
# Set up an archive command that will copy the history file but not the WAL
# files. No real archive command should behave this way; the point is to
@ -47,7 +47,7 @@ my $backup_name = 'my_backup';
$node_primary->backup($backup_name);
# Create streaming standby linking to primary
my $node_standby = get_new_node('standby');
my $node_standby = PostgresNode->new('standby');
$node_standby->init_from_backup(
$node_primary, $backup_name,
allows_streaming => 1,
@ -60,7 +60,7 @@ $node_standby->backup($backup_name, backup_options => ['-Xnone']);
# Create cascading standby but don't start it yet.
# Must set up both streaming and archiving.
my $node_cascade = get_new_node('cascade');
my $node_cascade = PostgresNode->new('cascade');
$node_cascade->init_from_backup($node_standby, $backup_name,
has_streaming => 1);
$node_cascade->enable_restoring($node_primary);

@ -64,7 +64,7 @@ push @keys, 'client_wrongperms';
#### Set up the server.
note "setting up data directory";
my $node = get_new_node('primary');
my $node = PostgresNode->new('primary');
$node->init;
# PGHOST is enforced here to set up the node, subsequent connections

@ -38,7 +38,7 @@ my $common_connstr;
# Set up the server.
note "setting up data directory";
my $node = get_new_node('primary');
my $node = PostgresNode->new('primary');
$node->init;
# PGHOST is enforced here to set up the node, subsequent connections

@ -9,12 +9,12 @@ use TestLib;
use Test::More tests => 32;
# Initialize publisher node
my $node_publisher = get_new_node('publisher');
my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical');
$node_publisher->start;
# Create subscriber node
my $node_subscriber = get_new_node('subscriber');
my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start;

@ -10,12 +10,12 @@ use TestLib;
use Test::More tests => 4;
# Initialize publisher node
my $node_publisher = get_new_node('publisher');
my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical');
$node_publisher->start;
# Create subscriber node
my $node_subscriber = get_new_node('subscriber');
my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start;

@ -9,12 +9,12 @@ use TestLib;
use Test::More tests => 6;
# Initialize publisher node
my $node_publisher = get_new_node('publisher');
my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical');
$node_publisher->start;
# Create subscriber node
my $node_subscriber = get_new_node('subscriber');
my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start;

@ -9,12 +9,12 @@ use TestLib;
use Test::More tests => 8;
# Initialize publisher node
my $node_publisher = get_new_node('publisher');
my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical');
$node_publisher->start;
# Create subscriber node
my $node_subscriber = get_new_node('subscriber');
my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->append_conf('postgresql.conf',
"wal_retrieve_retry_interval = 1ms");

@ -8,13 +8,13 @@ use PostgresNode;
use TestLib;
use Test::More tests => 1;
my $node_publisher = get_new_node('publisher');
my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(
allows_streaming => 'logical',
extra => [ '--locale=C', '--encoding=UTF8' ]);
$node_publisher->start;
my $node_subscriber = get_new_node('subscriber');
my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(
allows_streaming => 'logical',
extra => [ '--locale=C', '--encoding=LATIN1' ]);

@ -8,11 +8,11 @@ use PostgresNode;
use TestLib;
use Test::More tests => 2;
my $node_publisher = get_new_node('publisher');
my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical');
$node_publisher->start;
my $node_subscriber = get_new_node('subscriber');
my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start;

@ -8,11 +8,11 @@ use PostgresNode;
use TestLib;
use Test::More tests => 1;
my $node_publisher = get_new_node('publisher');
my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical');
$node_publisher->start;
my $node_subscriber = get_new_node('subscriber');
my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start;

@ -9,12 +9,12 @@ use TestLib;
use Test::More tests => 5;
# Create publisher node
my $node_publisher = get_new_node('publisher');
my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical');
$node_publisher->start;
# Create subscriber node
my $node_subscriber = get_new_node('subscriber');
my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start;

@ -8,11 +8,11 @@ use PostgresNode;
use TestLib;
use Test::More tests => 1;
my $node_publisher = get_new_node('publisher');
my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical');
$node_publisher->start;
my $node_subscriber = get_new_node('subscriber');
my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start;

@ -10,11 +10,11 @@ use Test::More tests => 14;
# setup
my $node_publisher = get_new_node('publisher');
my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical');
$node_publisher->start;
my $node_subscriber = get_new_node('subscriber');
my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->append_conf('postgresql.conf',
qq(max_logical_replication_workers = 6));

@ -10,11 +10,11 @@ use Test::More tests => 2;
# setup
my $node_publisher = get_new_node('publisher');
my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical');
$node_publisher->start;
my $node_subscriber = get_new_node('subscriber');
my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start;

@ -18,13 +18,13 @@ else
plan skip_all => 'ICU not supported by this build';
}
my $node_publisher = get_new_node('publisher');
my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(
allows_streaming => 'logical',
extra => [ '--locale=C', '--encoding=UTF8' ]);
$node_publisher->start;
my $node_subscriber = get_new_node('subscriber');
my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(
allows_streaming => 'logical',
extra => [ '--locale=C', '--encoding=UTF8' ]);

@ -10,15 +10,15 @@ use Test::More tests => 62;
# setup
my $node_publisher = get_new_node('publisher');
my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical');
$node_publisher->start;
my $node_subscriber1 = get_new_node('subscriber1');
my $node_subscriber1 = PostgresNode->new('subscriber1');
$node_subscriber1->init(allows_streaming => 'logical');
$node_subscriber1->start;
my $node_subscriber2 = get_new_node('subscriber2');
my $node_subscriber2 = PostgresNode->new('subscriber2');
$node_subscriber2->init(allows_streaming => 'logical');
$node_subscriber2->start;

@ -10,12 +10,12 @@ use TestLib;
use Test::More tests => 5;
# Create and initialize a publisher node
my $node_publisher = get_new_node('publisher');
my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical');
$node_publisher->start;
# Create and initialize subscriber node
my $node_subscriber = get_new_node('subscriber');
my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save