root/test/t/001_db_init.t

Revision 67a6f35109ef607de8abcc340885cfcd7a6b9966, 0.9 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 2 years ago)

jMCg: but *this* is Debuntu... It's *special*

  • Property mode set to 100644
Line 
1 use Test::More tests => 5;
2 use testconfig;
3
4 use strict;
5
6 SKIP: {
7   skip "no existing test db to cleanup", 1 unless (-d "$NOIT_TEST_DB");
8   `pg_ctl -D $NOIT_TEST_DB -w -m immediate stop`;
9   `rm -rf $NOIT_TEST_DB`;
10   ok(! -d "$NOIT_TEST_DB", 'cleaned up running instance');
11 }
12 ok(-r '../../sql/reconnoiter_ddl_dump.sql', 'SQL to load');
13 ok(`initdb -A trust $NOIT_TEST_DB`);
14 open (F, ">>$NOIT_TEST_DB/postgresql.conf");
15 print F "listen_addresses = 'localhost'\n";
16 print F "unix_socket_directory = '$NOIT_TEST_DB'\n";
17 print F "port = $NOIT_TEST_DB_PORT\n";
18 close(F);
19 `pg_ctl -D $NOIT_TEST_DB -l $NOIT_TEST_DB/serverlog -s -w start`;
20 SKIP: {
21   # This is failing on my Mac which is OBNOXIOUS
22   skip "pg_ctl and \$? issues on darwin", 1 if $^O eq 'darwin';
23   is($?, 0, 'starting postgres');
24 }
25
26 my $conn = pg();
27 BAIL_OUT("cannot continue tests without DB") unless($conn);
28 ok($conn, "connect to database");
29 undef $conn;
30
31 1;
Note: See TracBrowser for help on using the browser.