aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2014-09-13 15:18:49 -0400
committerPeter Eisentraut <peter_e@gmx.net>2014-09-13 15:18:49 -0400
commit839acf9461deb0affb0dd710723cffeb72ffd82f (patch)
tree4e81ad42a2110672748b66208ce3e716c8f1ec07 /src
parent95c38a989569abe4981ae25ef03ffb2c328f6c83 (diff)
downloadpostgresql-839acf9461deb0affb0dd710723cffeb72ffd82f.tar.gz
postgresql-839acf9461deb0affb0dd710723cffeb72ffd82f.zip
pg_ctl: Add tests for behavior with nonexistent data directory
This behavior was made more precise in commit 11d205e2bd66cefe0b7d69c02e831cd055cbb5bb.
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_ctl/t/001_start_stop.pl5
-rw-r--r--src/bin/pg_ctl/t/002_status.pl5
2 files changed, 8 insertions, 2 deletions
diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl
index 79f5db71b26..66ff06e3c48 100644
--- a/src/bin/pg_ctl/t/001_start_stop.pl
+++ b/src/bin/pg_ctl/t/001_start_stop.pl
@@ -1,7 +1,7 @@
use strict;
use warnings;
use TestLib;
-use Test::More tests => 10;
+use Test::More tests => 11;
my $tempdir = TestLib::tempdir;
my $tempdir_short = TestLib::tempdir_short;
@@ -10,6 +10,9 @@ program_help_ok('pg_ctl');
program_version_ok('pg_ctl');
program_options_handling_ok('pg_ctl');
+command_exit_is([ 'pg_ctl', 'start', '-D', "$tempdir/nonexistent" ],
+ 1, 'pg_ctl start with nonexistent directory');
+
command_ok([ 'pg_ctl', 'initdb', '-D', "$tempdir/data" ], 'pg_ctl initdb');
open CONF, ">>$tempdir/data/postgresql.conf";
print CONF "listen_addresses = ''\n";
diff --git a/src/bin/pg_ctl/t/002_status.pl b/src/bin/pg_ctl/t/002_status.pl
index e10fd1b3e39..9502b6f7b22 100644
--- a/src/bin/pg_ctl/t/002_status.pl
+++ b/src/bin/pg_ctl/t/002_status.pl
@@ -1,11 +1,14 @@
use strict;
use warnings;
use TestLib;
-use Test::More tests => 2;
+use Test::More tests => 3;
my $tempdir = TestLib::tempdir;
my $tempdir_short = TestLib::tempdir_short;
+command_exit_is([ 'pg_ctl', 'status', '-D', "$tempdir/nonexistent" ],
+ 4, 'pg_ctl status with nonexistent directory');
+
system_or_bail "initdb -D '$tempdir'/data -A trust >/dev/null";
open CONF, ">>$tempdir/data/postgresql.conf";
print CONF "listen_addresses = ''\n";