Skip to content

Commit 5dc932f

Browse files
committed
Remove the last vestiges of Exporter from PostgresNode
Clients wanting to call get_free_port now need to do so via a qualified name: PostgresNode::get_free_port().
1 parent 201a761 commit 5dc932f

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

src/bin/pg_ctl/t/001_start_stop.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
'pg_ctl initdb');
2626
command_ok([ $ENV{PG_REGRESS}, '--config-auth', "$tempdir/data" ],
2727
'configure authentication');
28-
my $node_port = get_free_port();
28+
my $node_port = PostgresNode::get_free_port();
2929
open my $conf, '>>', "$tempdir/data/postgresql.conf";
3030
print $conf "fsync = off\n";
3131
print $conf "port = $node_port\n";

src/test/kerberos/t/001_auth.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
my $krb5_cache = "${TestLib::tmp_check}/krb5cc";
7575
my $krb5_log = "${TestLib::log_path}/krb5libs.log";
7676
my $kdc_log = "${TestLib::log_path}/krb5kdc.log";
77-
my $kdc_port = get_free_port();
77+
my $kdc_port = PostgresNode::get_free_port();
7878
my $kdc_datadir = "${TestLib::tmp_check}/krb5kdc";
7979
my $kdc_pidfile = "${TestLib::tmp_check}/krb5kdc.pid";
8080
my $keytab = "${TestLib::tmp_check}/krb5.keytab";

src/test/ldap/t/001_auth.pl

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
my $slapd_logfile = "${TestLib::log_path}/slapd.log";
5959
my $ldap_conf = "${TestLib::tmp_check}/ldap.conf";
6060
my $ldap_server = 'localhost';
61-
my $ldap_port = get_free_port();
62-
my $ldaps_port = get_free_port();
61+
my $ldap_port = PostgresNode::get_free_port();
62+
my $ldaps_port = PostgresNode::get_free_port();
6363
my $ldap_url = "ldap://$ldap_server:$ldap_port";
6464
my $ldaps_url = "ldaps://$ldap_server:$ldaps_port";
6565
my $ldap_basedn = 'dc=example,dc=net';

src/test/perl/PostgresNode.pm

+6-8
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ PostgresNode - class representing PostgreSQL server instance
6969
$node->stop('fast');
7070
7171
# Find a free, unprivileged TCP port to bind some other service to
72-
my $port = get_free_port();
72+
my $port = PostgresNode::get_free_port();
7373
7474
=head1 DESCRIPTION
7575
@@ -93,7 +93,6 @@ use warnings;
9393
use Carp;
9494
use Config;
9595
use Cwd;
96-
use Exporter 'import';
9796
use Fcntl qw(:mode);
9897
use File::Basename;
9998
use File::Path qw(rmtree);
@@ -109,10 +108,6 @@ use TestLib ();
109108
use Time::HiRes qw(usleep);
110109
use Scalar::Util qw(blessed);
111110

112-
our @EXPORT = qw(
113-
get_free_port
114-
);
115-
116111
our ($use_tcp, $test_localhost, $test_pghost, $last_host_assigned,
117112
$last_port_assigned, @all_nodes, $died);
118113

@@ -1381,15 +1376,18 @@ sub installed_command
13811376
=item get_free_port()
13821377
13831378
Locate an unprivileged (high) TCP port that's not currently bound to
1384-
anything. This is used by new(), and is also exported for use
1385-
by test cases that need to start other, non-Postgres servers.
1379+
anything. This is used by C<new()>, and also by some test cases that need to
1380+
start other, non-Postgres servers.
13861381
13871382
Ports assigned to existing PostgresNode objects are automatically
13881383
excluded, even if those servers are not currently running.
13891384
13901385
XXX A port available now may become unavailable by the time we start
13911386
the desired service.
13921387
1388+
Note: this is not an instance method. As it's not exported it should be
1389+
called from outside the module as C<PostgresNode::get_free_port()>.
1390+
13931391
=cut
13941392

13951393
sub get_free_port

0 commit comments

Comments
 (0)