Commit ecb40ddb authored by Martin Pitt's avatar Martin Pitt

* t/030_errors.t: Check that pg_wrapper and administration programs give

  sane error messages instead of 'Invalid symbolic link blabla' for a
  nonexisting cluster.
parent f2bcb08f
postgresql-common (50) unstable; urgency=low
*
* t/030_errors.t: Check that pg_wrapper and administration programs give
sane error messages instead of 'Invalid symbolic link blabla' for a
nonexisting cluster.
-- Martin Pitt <mpitt@debian.org> Mon, 3 Apr 2006 09:34:31 +0200
-- Martin Pitt <mpitt@debian.org> Tue, 4 Apr 2006 22:34:32 +0200
postgresql-common (49) unstable; urgency=low
......
......@@ -4,7 +4,7 @@ use strict;
use lib 't';
use TestLib;
use Test::More tests => 51;
use Test::More tests => 75;
use lib '/usr/share/postgresql-common';
use PgCommon;
......@@ -24,6 +24,14 @@ sub create_foo_pid {
chmod 0700, "/var/lib/postgresql/$version/main/postmaster.pid" or die "chmod: $!";
}
sub check_nonexisting_cluster_error {
my $outref;
my $result = exec_as 0, $_[0], $outref;
is $result, 1, "'$_[0]' fails";
like $$outref, qr/(invalid version|does not exist)/i, "$_[0] gives error message about nonexisting cluster";
unlike $$outref, qr/invalid symbolic link/i, "$_[0] does not print 'invalid symbolic link' gibberish";
}
# create cluster
ok ((system "pg_createcluster --socketdir '$socketdir' $version main >/dev/null") == 0,
"pg_createcluster --socketdir");
......@@ -136,6 +144,16 @@ ok ((system "pg_dropcluster $version main") == 0,
ok_dir $socketdir, [], 'No sockets any more';
rmdir $socketdir or die "rmdir: $!";
# ensure sane error messages for nonexisting clusters
check_nonexisting_cluster_error 'psql --cluster 4.5/foo';
check_nonexisting_cluster_error "psql --cluster $MAJORS[0]/foo";
check_nonexisting_cluster_error "pg_dropcluster 4.5 foo";
check_nonexisting_cluster_error "pg_dropcluster $MAJORS[0] foo";
check_nonexisting_cluster_error "pg_upgradecluster 4.5 foo";
check_nonexisting_cluster_error "pg_upgradecluster $MAJORS[0] foo";
check_nonexisting_cluster_error "pg_ctlcluster 4.5 foo stop";
check_nonexisting_cluster_error "pg_ctlcluster $MAJORS[0] foo stop";
check_clean;
# vim: filetype=perl
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