From: Darold Gilles Date: Sun, 7 Apr 2019 08:05:59 +0000 (+0200) Subject: Add regression test for logplex format. X-Git-Tag: v11.0~43 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cd3cac66b0b3603febecbb9e013dc12a0809b09f;p=pgbadger Add regression test for logplex format. --- diff --git a/t/03_consistency.t b/t/03_consistency.t index 04458e8..c70bd34 100755 --- a/t/03_consistency.t +++ b/t/03_consistency.t @@ -1,9 +1,10 @@ -use Test::Simple tests => 6; +use Test::Simple tests => 8; use JSON::XS; my $json = new JSON::XS; my $LOG = 't/fixtures/light.postgres.log.bz2 t/fixtures/pgbouncer.log.gz'; +my $HLOG = 't/fixtures/logplex.gz'; my $BIN = 'out.bin'; my $OUT = 'out.json'; @@ -30,3 +31,12 @@ ok( $json_ref->{pgb_session_info}{chronos}{20180912}{16}{count} == 63943, "pgBou `rm -f $OUT`; +$ret = `perl pgbadger -q -o $OUT $HLOG`; +ok( $? == 0, "Generate json report for heroku log file"); + +$json_ref = $json->decode(`cat $OUT`); + +ok( $json_ref->{database_info}{unknown}{"CTE|duration"} eq "21761.546", "Consistent CTE duration"); + +`rm -f $OUT`; + diff --git a/t/fixtures/logplex.gz b/t/fixtures/logplex.gz new file mode 100644 index 0000000..570e0d9 Binary files /dev/null and b/t/fixtures/logplex.gz differ