root/test/t/002_db_load.t

Revision 239594a76cc5a52d016357dde39705aee39bd2e4, 0.9 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 3 years ago)

fix this to run on my Mac again

  • Property mode set to 100644
Line 
1 use Test::More tests => 5;
2 use testconfig;
3 use IPC::Open3;
4 use IO::File;
5
6 use strict;
7
8 my $conn;
9
10 $conn = pg('reconnoiter','reconnoiter');
11 SKIP: {
12   skip 'already loaded schema', 1 if($conn);
13   my $cmd = "psql -h localhost -p $NOIT_TEST_DB_PORT postgres " .
14                 "-f ../../sql/reconnoiter_ddl_dump.sql";
15   my $rdr = IO::File->new(">logs/002_psql.out");
16   my $wtr;
17   my $pid = open3($wtr, ">&".$rdr->fileno, \*CHLD_ERR, $cmd);
18   $wtr->close();
19   my $bad = '';
20   while(<CHLD_ERR>) {
21     $bad .= $_ unless /\b(NOTICE|INFO)\b/;
22   }
23   close(CHLD_ERR);
24   waitpid($pid, 0);
25   is($bad, '', 'no errors during schema load');
26 }
27 $conn = pg('reconnoiter','reconnoiter');
28 ok($conn, 'connected under new user');
29 my $s = $conn->prepare("select count(*) from noit.metric_numeric_rollup_config");
30 ok($s, 'prepared test query');
31 ok($s->execute(), 'executed test query');
32 is($s->fetchrow(), 6, 'rollups exist');
33 undef $conn;
34
35 1;
Note: See TracBrowser for help on using the browser.