1use strict; 2use warnings; 3 4use PostgresNode; 5use TestLib; 6use Test::More tests => 3; 7 8my $tempdir = TestLib::tempdir; 9my $tempdir_short = TestLib::tempdir_short; 10 11command_exit_is([ 'pg_ctl', 'status', '-D', "$tempdir/nonexistent" ], 12 4, 'pg_ctl status with nonexistent directory'); 13 14my $node = get_new_node('main'); 15$node->init; 16 17command_exit_is([ 'pg_ctl', 'status', '-D', $node->data_dir ], 18 3, 'pg_ctl status with server not running'); 19 20system_or_bail 'pg_ctl', '-l', "$tempdir/logfile", '-D', 21 $node->data_dir, '-w', 'start'; 22command_exit_is([ 'pg_ctl', 'status', '-D', $node->data_dir ], 23 0, 'pg_ctl status with server running'); 24 25system_or_bail 'pg_ctl', 'stop', '-D', $node->data_dir; 26