mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-23 19:39:53 +08:00
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().
This commit is contained in:
parent
201a76183e
commit
5dc932f9e7
@ -25,7 +25,7 @@ command_ok([ 'pg_ctl', 'initdb', '-D', "$tempdir/data", '-o', '-N' ],
|
|||||||
'pg_ctl initdb');
|
'pg_ctl initdb');
|
||||||
command_ok([ $ENV{PG_REGRESS}, '--config-auth', "$tempdir/data" ],
|
command_ok([ $ENV{PG_REGRESS}, '--config-auth', "$tempdir/data" ],
|
||||||
'configure authentication');
|
'configure authentication');
|
||||||
my $node_port = get_free_port();
|
my $node_port = PostgresNode::get_free_port();
|
||||||
open my $conf, '>>', "$tempdir/data/postgresql.conf";
|
open my $conf, '>>', "$tempdir/data/postgresql.conf";
|
||||||
print $conf "fsync = off\n";
|
print $conf "fsync = off\n";
|
||||||
print $conf "port = $node_port\n";
|
print $conf "port = $node_port\n";
|
||||||
|
@ -74,7 +74,7 @@ my $kdc_conf = "${TestLib::tmp_check}/kdc.conf";
|
|||||||
my $krb5_cache = "${TestLib::tmp_check}/krb5cc";
|
my $krb5_cache = "${TestLib::tmp_check}/krb5cc";
|
||||||
my $krb5_log = "${TestLib::log_path}/krb5libs.log";
|
my $krb5_log = "${TestLib::log_path}/krb5libs.log";
|
||||||
my $kdc_log = "${TestLib::log_path}/krb5kdc.log";
|
my $kdc_log = "${TestLib::log_path}/krb5kdc.log";
|
||||||
my $kdc_port = get_free_port();
|
my $kdc_port = PostgresNode::get_free_port();
|
||||||
my $kdc_datadir = "${TestLib::tmp_check}/krb5kdc";
|
my $kdc_datadir = "${TestLib::tmp_check}/krb5kdc";
|
||||||
my $kdc_pidfile = "${TestLib::tmp_check}/krb5kdc.pid";
|
my $kdc_pidfile = "${TestLib::tmp_check}/krb5kdc.pid";
|
||||||
my $keytab = "${TestLib::tmp_check}/krb5.keytab";
|
my $keytab = "${TestLib::tmp_check}/krb5.keytab";
|
||||||
|
@ -58,8 +58,8 @@ my $slapd_pidfile = "${TestLib::tmp_check}/slapd.pid";
|
|||||||
my $slapd_logfile = "${TestLib::log_path}/slapd.log";
|
my $slapd_logfile = "${TestLib::log_path}/slapd.log";
|
||||||
my $ldap_conf = "${TestLib::tmp_check}/ldap.conf";
|
my $ldap_conf = "${TestLib::tmp_check}/ldap.conf";
|
||||||
my $ldap_server = 'localhost';
|
my $ldap_server = 'localhost';
|
||||||
my $ldap_port = get_free_port();
|
my $ldap_port = PostgresNode::get_free_port();
|
||||||
my $ldaps_port = get_free_port();
|
my $ldaps_port = PostgresNode::get_free_port();
|
||||||
my $ldap_url = "ldap://$ldap_server:$ldap_port";
|
my $ldap_url = "ldap://$ldap_server:$ldap_port";
|
||||||
my $ldaps_url = "ldaps://$ldap_server:$ldaps_port";
|
my $ldaps_url = "ldaps://$ldap_server:$ldaps_port";
|
||||||
my $ldap_basedn = 'dc=example,dc=net';
|
my $ldap_basedn = 'dc=example,dc=net';
|
||||||
|
@ -69,7 +69,7 @@ PostgresNode - class representing PostgreSQL server instance
|
|||||||
$node->stop('fast');
|
$node->stop('fast');
|
||||||
|
|
||||||
# Find a free, unprivileged TCP port to bind some other service to
|
# Find a free, unprivileged TCP port to bind some other service to
|
||||||
my $port = get_free_port();
|
my $port = PostgresNode::get_free_port();
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
@ -93,7 +93,6 @@ use warnings;
|
|||||||
use Carp;
|
use Carp;
|
||||||
use Config;
|
use Config;
|
||||||
use Cwd;
|
use Cwd;
|
||||||
use Exporter 'import';
|
|
||||||
use Fcntl qw(:mode);
|
use Fcntl qw(:mode);
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
use File::Path qw(rmtree);
|
use File::Path qw(rmtree);
|
||||||
@ -109,10 +108,6 @@ use TestLib ();
|
|||||||
use Time::HiRes qw(usleep);
|
use Time::HiRes qw(usleep);
|
||||||
use Scalar::Util qw(blessed);
|
use Scalar::Util qw(blessed);
|
||||||
|
|
||||||
our @EXPORT = qw(
|
|
||||||
get_free_port
|
|
||||||
);
|
|
||||||
|
|
||||||
our ($use_tcp, $test_localhost, $test_pghost, $last_host_assigned,
|
our ($use_tcp, $test_localhost, $test_pghost, $last_host_assigned,
|
||||||
$last_port_assigned, @all_nodes, $died);
|
$last_port_assigned, @all_nodes, $died);
|
||||||
|
|
||||||
@ -1381,8 +1376,8 @@ sub installed_command
|
|||||||
=item get_free_port()
|
=item get_free_port()
|
||||||
|
|
||||||
Locate an unprivileged (high) TCP port that's not currently bound to
|
Locate an unprivileged (high) TCP port that's not currently bound to
|
||||||
anything. This is used by new(), and is also exported for use
|
anything. This is used by C<new()>, and also by some test cases that need to
|
||||||
by test cases that need to start other, non-Postgres servers.
|
start other, non-Postgres servers.
|
||||||
|
|
||||||
Ports assigned to existing PostgresNode objects are automatically
|
Ports assigned to existing PostgresNode objects are automatically
|
||||||
excluded, even if those servers are not currently running.
|
excluded, even if those servers are not currently running.
|
||||||
@ -1390,6 +1385,9 @@ excluded, even if those servers are not currently running.
|
|||||||
XXX A port available now may become unavailable by the time we start
|
XXX A port available now may become unavailable by the time we start
|
||||||
the desired service.
|
the desired service.
|
||||||
|
|
||||||
|
Note: this is not an instance method. As it's not exported it should be
|
||||||
|
called from outside the module as C<PostgresNode::get_free_port()>.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub get_free_port
|
sub get_free_port
|
||||||
|
Loading…
Reference in New Issue
Block a user