Commit e8e59795 authored by Martin Pitt's avatar Martin Pitt

* t/030_errors.t: Check behaviour of starting of clusters with colliding

  ports. Reproduces #472627.
* pg_ctlcluster: Error out with a port collision message if another cluster
  is already running on the port. (Closes: #472627)
parent 9b524b1f
......@@ -5,8 +5,12 @@ postgresql-common (94) UNRELEASED; urgency=low
* pg_createcluster: Make the cluster configuration directory, "start.conf",
and "environment" owned by the cluster superuser instead of root.
(Closes: #481349)
* t/030_errors.t: Check behaviour of starting of clusters with colliding
ports. Reproduces #472627.
* pg_ctlcluster: Error out with a port collision message if another cluster
is already running on the port. (Closes: #472627)
-- Martin Pitt <mpitt@debian.org> Sun, 23 Nov 2008 19:19:04 +0100
-- Martin Pitt <mpitt@debian.org> Sun, 23 Nov 2008 20:24:36 +0100
postgresql-common (93) unstable; urgency=low
......
......@@ -243,6 +243,14 @@ sub start {
start_check_pid_file;
# check conflicting port
foreach my $v (get_versions) {
foreach my $c (get_version_clusters $v) {
error("Port conflict: cluster $v/$c is already running on port " .
$info{'port'}) if cluster_port_running $v, $c, $info{'port'};
}
}
# get locale used by initdb
my ($lc_ctype, $lc_collate) = get_cluster_locales $version, $cluster;
$lc_ctype or error ('Could not parse locale out of pg_controldata output');
......
......@@ -6,7 +6,7 @@ require File::Temp;
use lib 't';
use TestLib;
use Test::More tests => 154;
use Test::More tests => 162;
use lib '/usr/share/postgresql-common';
use PgCommon;
......@@ -237,6 +237,22 @@ is_program_out 'postgres', "pg_ctlcluster $version main start", 0, '',
'pg_ctlcluster start succeeds again with reappeared /var/lib/postgresql';
is_program_out 'postgres', "pg_ctlcluster $version main stop", 0, '', 'stopping cluster';
# pg_ctlcluster checks colliding ports
ok ((system "pg_createcluster $version other >/dev/null") == 0,
"pg_createcluster other");
set_cluster_port $version, 'other', '5432';
is ((exec_as 'postgres', "pg_ctlcluster $version main start"), 0,
'pg_ctlcluster: main cluster on conflicting port starts');
like_program_out 'postgres', "pg_ctlcluster $version other start", 1,
qr/conflict.*8.3\/main/,
'pg_ctlcluster other cluster on conflicting port fails';
is_program_out 'postgres', "pg_ctlcluster $version main stop", 0, '',
'stopping main cluster';
is ((exec_as 'postgres', "pg_ctlcluster $version other start"), 0,
'pg_ctlcluster: other cluster on conflicting port starts after main is down');
ok ((system "pg_dropcluster $version other --stop") == 0,
'pg_dropcluster other');
# clean up
ok ((system "pg_dropcluster $version main") == 0,
'pg_dropcluster');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment