Skip to content

Commit 201a761

Browse files
committed
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).
1 parent dbfe6e4 commit 201a761

File tree

109 files changed

+212
-238
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+212
-238
lines changed

contrib/amcheck/t/001_verify_heapam.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#
1616
# Test set-up
1717
#
18-
$node = get_new_node('test');
18+
$node = PostgresNode->new('test');
1919
$node->init;
2020
$node->append_conf('postgresql.conf', 'autovacuum=off');
2121
$node->start;

contrib/auto_explain/t/001_auto_explain.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use TestLib;
99
use Test::More tests => 4;
1010

11-
my $node = get_new_node('main');
11+
my $node = PostgresNode->new('main');
1212
$node->init;
1313
$node->append_conf('postgresql.conf',
1414
"shared_preload_libraries = 'auto_explain'");

contrib/bloom/t/001_wal.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ sub test_index_replay
4343
}
4444

4545
# Initialize primary node
46-
$node_primary = get_new_node('primary');
46+
$node_primary = PostgresNode->new('primary');
4747
$node_primary->init(allows_streaming => 1);
4848
$node_primary->start;
4949
my $backup_name = 'my_backup';
@@ -52,7 +52,7 @@ sub test_index_replay
5252
$node_primary->backup($backup_name);
5353

5454
# Create streaming standby linking to primary
55-
$node_standby = get_new_node('standby');
55+
$node_standby = PostgresNode->new('standby');
5656
$node_standby->init_from_backup($node_primary, $backup_name,
5757
has_streaming => 1);
5858
$node_standby->start;

contrib/test_decoding/t/001_repl_stats.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Test::More tests => 2;
1212

1313
# Test set-up
14-
my $node = get_new_node('test');
14+
my $node = PostgresNode->new('test');
1515
$node->init(allows_streaming => 'logical');
1616
$node->append_conf('postgresql.conf', 'synchronous_commit = on');
1717
$node->start;

src/bin/pg_amcheck/t/002_nonesuch.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
# Test set-up
1212
my ($node, $port);
13-
$node = get_new_node('test');
13+
$node = PostgresNode->new('test');
1414
$node->init;
1515
$node->start;
1616
$port = $node->port;

src/bin/pg_amcheck/t/003_check.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ ()
120120
}
121121

122122
# Test set-up
123-
$node = get_new_node('test');
123+
$node = PostgresNode->new('test');
124124
$node->init;
125125
$node->append_conf('postgresql.conf', 'autovacuum=off');
126126
$node->start;

src/bin/pg_amcheck/t/004_verify_heapam.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ sub write_tuple
178178
# Set up the node. Once we create and corrupt the table,
179179
# autovacuum workers visiting the table could crash the backend.
180180
# Disable autovacuum so that won't happen.
181-
my $node = get_new_node('test');
181+
my $node = PostgresNode->new('test');
182182
$node->init;
183183
$node->append_conf('postgresql.conf', 'autovacuum=off');
184184

src/bin/pg_amcheck/t/005_opclass_damage.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use TestLib;
1111
use Test::More tests => 5;
1212

13-
my $node = get_new_node('test');
13+
my $node = PostgresNode->new('test');
1414
$node->init;
1515
$node->start;
1616

src/bin/pg_basebackup/t/010_pg_basebackup.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
my $tempdir = TestLib::tempdir;
2020

21-
my $node = get_new_node('main');
21+
my $node = PostgresNode->new('main');
2222

2323
# Set umask so test directories and files are created with default permissions
2424
umask(0077);
@@ -268,7 +268,7 @@
268268
skip "no tar program available", 1
269269
if (!defined $tar || $tar eq '');
270270

271-
my $node2 = get_new_node('replica');
271+
my $node2 = PostgresNode->new('replica');
272272

273273
# Recover main data directory
274274
$node2->init_from_backup($node, 'tarbackup2', tar_program => $tar);

src/bin/pg_basebackup/t/020_pg_receivewal.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# Set umask so test directories and files are created with default permissions
1515
umask(0077);
1616

17-
my $primary = get_new_node('primary');
17+
my $primary = PostgresNode->new('primary');
1818
$primary->init(allows_streaming => 1);
1919
$primary->start;
2020

src/bin/pg_basebackup/t/030_pg_recvlogical.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
program_version_ok('pg_recvlogical');
1212
program_options_handling_ok('pg_recvlogical');
1313

14-
my $node = get_new_node('main');
14+
my $node = PostgresNode->new('main');
1515

1616
# Initialize node without replication settings
1717
$node->init(allows_streaming => 1, has_archiving => 1);

src/bin/pg_checksums/t/002_actions.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ sub check_relation_corruption
9292
}
9393

9494
# Initialize node with checksums disabled.
95-
my $node = get_new_node('node_checksum');
95+
my $node = PostgresNode->new('node_checksum');
9696
$node->init();
9797
my $pgdata = $node->data_dir;
9898

src/bin/pg_controldata/t/001_pg_controldata.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
command_fails([ 'pg_controldata', 'nonexistent' ],
1515
'pg_controldata with nonexistent directory fails');
1616

17-
my $node = get_new_node('main');
17+
my $node = PostgresNode->new('main');
1818
$node->init;
1919

2020
command_like([ 'pg_controldata', $node->data_dir ],

src/bin/pg_ctl/t/002_status.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
command_exit_is([ 'pg_ctl', 'status', '-D', "$tempdir/nonexistent" ],
1515
4, 'pg_ctl status with nonexistent directory');
1616

17-
my $node = get_new_node('main');
17+
my $node = PostgresNode->new('main');
1818
$node->init;
1919

2020
command_exit_is([ 'pg_ctl', 'status', '-D', $node->data_dir ],

src/bin/pg_ctl/t/003_promote.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
qr/directory .* does not exist/,
1616
'pg_ctl promote with nonexistent directory');
1717

18-
my $node_primary = get_new_node('primary');
18+
my $node_primary = PostgresNode->new('primary');
1919
$node_primary->init(allows_streaming => 1);
2020

2121
command_fails_like(
@@ -30,7 +30,7 @@
3030
qr/not in standby mode/,
3131
'pg_ctl promote of primary instance fails');
3232

33-
my $node_standby = get_new_node('standby');
33+
my $node_standby = PostgresNode->new('standby');
3434
$node_primary->backup('my_backup');
3535
$node_standby->init_from_backup($node_primary, 'my_backup',
3636
has_streaming => 1);
@@ -47,7 +47,7 @@
4747
'promoted standby is not in recovery');
4848

4949
# same again with default wait option
50-
$node_standby = get_new_node('standby2');
50+
$node_standby = PostgresNode->new('standby2');
5151
$node_standby->init_from_backup($node_primary, 'my_backup',
5252
has_streaming => 1);
5353
$node_standby->start;

src/bin/pg_ctl/t/004_logrotate.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Time::HiRes qw(usleep);
1111

1212
# Set up node with logging collector
13-
my $node = get_new_node('primary');
13+
my $node = PostgresNode->new('primary');
1414
$node->init();
1515
$node->append_conf(
1616
'postgresql.conf', qq(

src/bin/pg_dump/t/002_pg_dump.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3562,7 +3562,7 @@
35623562
#########################################
35633563
# Create a PG instance to test actually dumping from
35643564
3565-
my $node = get_new_node('main');
3565+
my $node = PostgresNode->new('main');
35663566
$node->init;
35673567
$node->start;
35683568

src/bin/pg_dump/t/003_pg_dump_with_server.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
my $tempdir = TestLib::tempdir;
1212
my $tempdir_short = TestLib::tempdir_short;
1313

14-
my $node = get_new_node('main');
14+
my $node = PostgresNode->new('main');
1515
my $port = $node->port;
1616

1717
$node->init;

src/bin/pg_dump/t/010_dump_connstr.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
my $src_bootstrap_super = 'regress_postgres';
5252
my $dst_bootstrap_super = 'boot';
5353

54-
my $node = get_new_node('main');
54+
my $node = PostgresNode->new('main');
5555
$node->init(extra =>
5656
[ '-U', $src_bootstrap_super, '--locale=C', '--encoding=LATIN1' ]);
5757

@@ -181,7 +181,7 @@
181181
# Restore full dump through psql using environment variables for
182182
# dbname/user connection parameters
183183

184-
my $envar_node = get_new_node('destination_envar');
184+
my $envar_node = PostgresNode->new('destination_envar');
185185
$envar_node->init(
186186
extra =>
187187
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ],
@@ -208,7 +208,7 @@
208208
# dbname/user connection parameters. "\connect dbname=" forgets
209209
# user/port from command line.
210210

211-
my $cmdline_node = get_new_node('destination_cmdline');
211+
my $cmdline_node = PostgresNode->new('destination_cmdline');
212212
$cmdline_node->init(
213213
extra =>
214214
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ],

src/bin/pg_resetwal/t/001_basic.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
program_version_ok('pg_resetwal');
1313
program_options_handling_ok('pg_resetwal');
1414

15-
my $node = get_new_node('main');
15+
my $node = PostgresNode->new('main');
1616
$node->init;
1717

1818
command_like([ 'pg_resetwal', '-n', $node->data_dir ],

src/bin/pg_resetwal/t/002_corrupted.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use TestLib;
1111
use Test::More tests => 6;
1212

13-
my $node = get_new_node('main');
13+
my $node = PostgresNode->new('main');
1414
$node->init;
1515

1616
my $pg_control = $node->data_dir . '/global/pg_control';

src/bin/pg_rewind/t/007_standby_source.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@
5858
#
5959
# A (primary) <--- B (standby) <--- C (standby)
6060
$node_a->backup('my_backup');
61-
$node_b = get_new_node('node_b');
61+
$node_b = PostgresNode->new('node_b');
6262
$node_b->init_from_backup($node_a, 'my_backup', has_streaming => 1);
6363
$node_b->set_standby_mode();
6464
$node_b->start;
6565

6666
$node_b->backup('my_backup');
67-
$node_c = get_new_node('node_c');
67+
$node_c = PostgresNode->new('node_c');
6868
$node_c->init_from_backup($node_b, 'my_backup', has_streaming => 1);
6969
$node_c->set_standby_mode();
7070
$node_c->start;

src/bin/pg_rewind/t/008_min_recovery_point.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
my $tmp_folder = TestLib::tempdir;
4242

43-
my $node_1 = get_new_node('node_1');
43+
my $node_1 = PostgresNode->new('node_1');
4444
$node_1->init(allows_streaming => 1);
4545
$node_1->append_conf(
4646
'postgresql.conf', qq(
@@ -60,11 +60,11 @@
6060
my $backup_name = 'my_backup';
6161
$node_1->backup($backup_name);
6262

63-
my $node_2 = get_new_node('node_2');
63+
my $node_2 = PostgresNode->new('node_2');
6464
$node_2->init_from_backup($node_1, $backup_name, has_streaming => 1);
6565
$node_2->start;
6666

67-
my $node_3 = get_new_node('node_3');
67+
my $node_3 = PostgresNode->new('node_3');
6868
$node_3->init_from_backup($node_1, $backup_name, has_streaming => 1);
6969
$node_3->start;
7070

src/bin/pg_rewind/t/RewindTest.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ sub setup_cluster
128128

129129
# Initialize primary, data checksums are mandatory
130130
$node_primary =
131-
get_new_node('primary' . ($extra_name ? "_${extra_name}" : ''));
131+
PostgresNode->new('primary' . ($extra_name ? "_${extra_name}" : ''));
132132

133133
# Set up pg_hba.conf and pg_ident.conf for the role running
134134
# pg_rewind. This role is used for all the tests, and has
@@ -176,7 +176,7 @@ sub create_standby
176176
my $extra_name = shift;
177177

178178
$node_standby =
179-
get_new_node('standby' . ($extra_name ? "_${extra_name}" : ''));
179+
PostgresNode->new('standby' . ($extra_name ? "_${extra_name}" : ''));
180180
$node_primary->backup('my_backup');
181181
$node_standby->init_from_backup($node_primary, 'my_backup');
182182
my $connstr_primary = $node_primary->connstr();

src/bin/pg_verifybackup/t/002_algorithm.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use TestLib;
1313
use Test::More tests => 19;
1414

15-
my $primary = get_new_node('primary');
15+
my $primary = PostgresNode->new('primary');
1616
$primary->init(allows_streaming => 1);
1717
$primary->start;
1818

src/bin/pg_verifybackup/t/003_corruption.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use TestLib;
1313
use Test::More tests => 44;
1414

15-
my $primary = get_new_node('primary');
15+
my $primary = PostgresNode->new('primary');
1616
$primary->init(allows_streaming => 1);
1717
$primary->start;
1818

src/bin/pg_verifybackup/t/004_options.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Test::More tests => 25;
1414

1515
# Start up the server and take a backup.
16-
my $primary = get_new_node('primary');
16+
my $primary = PostgresNode->new('primary');
1717
$primary->init(allows_streaming => 1);
1818
$primary->start;
1919
my $backup_path = $primary->backup_dir . '/test_options';

src/bin/pg_verifybackup/t/006_encoding.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use TestLib;
1212
use Test::More tests => 5;
1313

14-
my $primary = get_new_node('primary');
14+
my $primary = PostgresNode->new('primary');
1515
$primary->init(allows_streaming => 1);
1616
$primary->start;
1717
my $backup_path = $primary->backup_dir . '/test_encoding';

src/bin/pg_verifybackup/t/007_wal.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Test::More tests => 7;
1414

1515
# Start up the server and take a backup.
16-
my $primary = get_new_node('primary');
16+
my $primary = PostgresNode->new('primary');
1717
$primary->init(allows_streaming => 1);
1818
$primary->start;
1919
my $backup_path = $primary->backup_dir . '/test_wal';

src/bin/pgbench/t/001_pgbench_with_server.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Config;
1111

1212
# start a pgbench specific server
13-
my $node = get_new_node('main');
13+
my $node = PostgresNode->new('main');
1414
$node->init;
1515
$node->start;
1616

src/bin/psql/t/010_tab_completion.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
}
3535

3636
# start a new server
37-
my $node = get_new_node('main');
37+
my $node = PostgresNode->new('main');
3838
$node->init;
3939
$node->start;
4040

src/bin/scripts/t/010_clusterdb.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
program_version_ok('clusterdb');
1313
program_options_handling_ok('clusterdb');
1414

15-
my $node = get_new_node('main');
15+
my $node = PostgresNode->new('main');
1616
$node->init;
1717
$node->start;
1818

src/bin/scripts/t/011_clusterdb_all.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use TestLib;
99
use Test::More tests => 2;
1010

11-
my $node = get_new_node('main');
11+
my $node = PostgresNode->new('main');
1212
$node->init;
1313
$node->start;
1414

src/bin/scripts/t/020_createdb.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
program_version_ok('createdb');
1313
program_options_handling_ok('createdb');
1414

15-
my $node = get_new_node('main');
15+
my $node = PostgresNode->new('main');
1616
$node->init;
1717
$node->start;
1818

src/bin/scripts/t/040_createuser.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
program_version_ok('createuser');
1313
program_options_handling_ok('createuser');
1414

15-
my $node = get_new_node('main');
15+
my $node = PostgresNode->new('main');
1616
$node->init;
1717
$node->start;
1818

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy